chrome_browser_main_win_browsertest.cc 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142
  1. // Copyright 2020 The Chromium Authors. All rights reserved.
  2. // Use of this source code is governed by a BSD-style license that can be
  3. // found in the LICENSE file.
  4. #include "chrome/browser/chrome_browser_main_win.h"
  5. #include "chrome/browser/browser_process.h"
  6. #include "chrome/common/pref_names.h"
  7. #include "chrome/test/base/in_process_browser_test.h"
  8. #include "components/prefs/pref_service.h"
  9. #include "components/version_info/version_info.h"
  10. #include "content/public/test/browser_test.h"
  11. #include "content/public/test/test_utils.h"
  12. using ChromeBrowserMainWinTest = InProcessBrowserTest;
  13. IN_PROC_BROWSER_TEST_F(ChromeBrowserMainWinTest, PRE_ShortcutsAreMigratedOnce) {
  14. // Wait for all startup tasks to run.
  15. content::RunAllTasksUntilIdle();
  16. // Confirm that shortcuts were migrated.
  17. const std::string last_version_migrated =
  18. g_browser_process->local_state()->GetString(
  19. prefs::kShortcutMigrationVersion);
  20. EXPECT_EQ(last_version_migrated, version_info::GetVersionNumber());
  21. // Set the version back as far as kLastVersionNeedingMigration and ensure it's
  22. // not migrated again.
  23. g_browser_process->local_state()->SetString(prefs::kShortcutMigrationVersion,
  24. "86.0.4231.0");
  25. }
  26. IN_PROC_BROWSER_TEST_F(ChromeBrowserMainWinTest, ShortcutsAreMigratedOnce) {
  27. content::RunAllTasksUntilIdle();
  28. // Confirm that shortcuts weren't migrated when marked as having last been
  29. // migrated in kLastVersionNeedingMigration+.
  30. const std::string last_version_migrated =
  31. g_browser_process->local_state()->GetString(
  32. prefs::kShortcutMigrationVersion);
  33. EXPECT_EQ(last_version_migrated, "86.0.4231.0");
  34. }