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" |
11 #include "base/version.h" | 11 #include "base/version.h" |
12 #include "base/win/registry.h" | 12 #include "base/win/registry.h" |
13 #include "chrome/common/chrome_constants.h" | 13 #include "chrome/common/chrome_constants.h" |
14 #include "chrome/common/chrome_paths.h" | 14 #include "chrome/common/chrome_paths.h" |
15 #include "chrome/installer/util/browser_distribution.h" | 15 #include "chrome/installer/util/browser_distribution.h" |
16 #include "chrome/installer/util/google_update_constants.h" | 16 #include "chrome/installer/util/google_update_constants.h" |
17 #include "chrome/test/base/in_process_browser_test.h" | 17 #include "chrome/test/base/in_process_browser_test.h" |
18 #include "content/public/browser/browser_thread.h" | 18 #include "content/public/browser/browser_thread.h" |
19 | 19 |
20 namespace downgrade { | 20 namespace downgrade { |
21 | 21 |
22 class UserDataDowngradeBrowserTestBase : public InProcessBrowserTest { | 22 class UserDataDowngradeBrowserTestBase : public InProcessBrowserTest { |
23 protected: | 23 protected: |
24 // content::BrowserTestBase: | 24 // content::BrowserTestBase: |
25 void SetUpInProcessBrowserTestFixture() override { | 25 void SetUpInProcessBrowserTestFixture() override { |
26 HKEY root = HKEY_CURRENT_USER; | 26 HKEY root = HKEY_CURRENT_USER; |
27 registry_override_manager_.OverrideRegistry(root); | 27 ASSERT_NO_FATAL_FAILURE(registry_override_manager_.OverrideRegistry(root)); |
28 key_.Create(root, | 28 key_.Create(root, |
29 BrowserDistribution::GetDistribution()->GetStateKey().c_str(), | 29 BrowserDistribution::GetDistribution()->GetStateKey().c_str(), |
30 KEY_SET_VALUE | KEY_WOW64_32KEY); | 30 KEY_SET_VALUE | KEY_WOW64_32KEY); |
31 } | 31 } |
32 | 32 |
33 // InProcessBrowserTest: | 33 // InProcessBrowserTest: |
34 bool SetUpUserDataDirectory() override { | 34 bool SetUpUserDataDirectory() override { |
35 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) | 35 if (!PathService::Get(chrome::DIR_USER_DATA, &user_data_dir_)) |
36 return false; | 36 return false; |
37 if (!CreateTemporaryFileInDir(user_data_dir_, &other_file_)) | 37 if (!CreateTemporaryFileInDir(user_data_dir_, &other_file_)) |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
125 ASSERT_TRUE(base::PathExists(other_file_)); | 125 ASSERT_TRUE(base::PathExists(other_file_)); |
126 } | 126 } |
127 | 127 |
128 // Verify the "Last Version" file won't be created for non-msi install. | 128 // Verify the "Last Version" file won't be created for non-msi install. |
129 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { | 129 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { |
130 ASSERT_FALSE(base::PathExists(last_version_file_path_)); | 130 ASSERT_FALSE(base::PathExists(last_version_file_path_)); |
131 ASSERT_TRUE(base::PathExists(other_file_)); | 131 ASSERT_TRUE(base::PathExists(other_file_)); |
132 } | 132 } |
133 | 133 |
134 } // namespace downgrade | 134 } // namespace downgrade |
OLD | NEW |