| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "chrome/browser/downgrade/user_data_downgrade.h" | 5 #include "chrome/browser/downgrade/user_data_downgrade.h" |
| 6 | 6 |
| 7 #include "base/files/file_util.h" | 7 #include "base/files/file_util.h" |
| 8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
| 9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
| 10 #include "base/test/test_reg_util_win.h" | 10 #include "base/test/test_reg_util_win.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 // content::BrowserTestBase: | 76 // content::BrowserTestBase: |
| 77 void SetUpInProcessBrowserTestFixture() override { | 77 void SetUpInProcessBrowserTestFixture() override { |
| 78 UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture(); | 78 UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture(); |
| 79 key_.WriteValue(L"DowngradeVersion", | 79 key_.WriteValue(L"DowngradeVersion", |
| 80 base::ASCIIToUTF16(GetNextChromeVersion()).c_str()); | 80 base::ASCIIToUTF16(GetNextChromeVersion()).c_str()); |
| 81 key_.WriteValue(google_update::kRegMSIField, 1); | 81 key_.WriteValue(google_update::kRegMSIField, 1); |
| 82 } | 82 } |
| 83 | 83 |
| 84 // InProcessBrowserTest: | 84 // InProcessBrowserTest: |
| 85 // Verify the content of renamed user data directory. | 85 // Verify the content of renamed user data directory. |
| 86 void RunTestOnMainThreadLoop() override { | 86 void SetUpOnMainThread() override { |
| 87 ASSERT_TRUE(base::DirectoryExists(moved_user_data_dir_)); | 87 ASSERT_TRUE(base::DirectoryExists(moved_user_data_dir_)); |
| 88 ASSERT_TRUE( | 88 ASSERT_TRUE( |
| 89 base::PathExists(moved_user_data_dir_.Append(other_file_.BaseName()))); | 89 base::PathExists(moved_user_data_dir_.Append(other_file_.BaseName()))); |
| 90 EXPECT_EQ(GetNextChromeVersion(), | 90 EXPECT_EQ(GetNextChromeVersion(), |
| 91 GetLastVersion(moved_user_data_dir_).GetString()); | 91 GetLastVersion(moved_user_data_dir_).GetString()); |
| 92 InProcessBrowserTest::RunTestOnMainThreadLoop(); | 92 UserDataDowngradeBrowserTestBase::SetUpOnMainThread(); |
| 93 } | 93 } |
| 94 }; | 94 }; |
| 95 | 95 |
| 96 class UserDataDowngradeBrowserNoResetTest | 96 class UserDataDowngradeBrowserNoResetTest |
| 97 : public UserDataDowngradeBrowserTestBase { | 97 : public UserDataDowngradeBrowserTestBase { |
| 98 protected: | 98 protected: |
| 99 // content::BrowserTestBase: | 99 // content::BrowserTestBase: |
| 100 void SetUpInProcessBrowserTestFixture() override { | 100 void SetUpInProcessBrowserTestFixture() override { |
| 101 UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture(); | 101 UserDataDowngradeBrowserTestBase::SetUpInProcessBrowserTestFixture(); |
| 102 key_.WriteValue(google_update::kRegMSIField, 1); | 102 key_.WriteValue(google_update::kRegMSIField, 1); |
| (...skipping 23 matching lines...) Expand all Loading... |
| 126 ASSERT_TRUE(base::PathExists(other_file_)); | 126 ASSERT_TRUE(base::PathExists(other_file_)); |
| 127 } | 127 } |
| 128 | 128 |
| 129 // Verify the "Last Version" file won't be created for non-msi install. | 129 // Verify the "Last Version" file won't be created for non-msi install. |
| 130 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { | 130 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { |
| 131 ASSERT_FALSE(base::PathExists(last_version_file_path_)); | 131 ASSERT_FALSE(base::PathExists(last_version_file_path_)); |
| 132 ASSERT_TRUE(base::PathExists(other_file_)); | 132 ASSERT_TRUE(base::PathExists(other_file_)); |
| 133 } | 133 } |
| 134 | 134 |
| 135 } // namespace downgrade | 135 } // namespace downgrade |
| OLD | NEW |