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/threading/sequenced_worker_pool.h" | 11 #include "base/threading/sequenced_worker_pool.h" |
| 12 #include "base/threading/thread_restrictions.h" |
12 #include "base/version.h" | 13 #include "base/version.h" |
13 #include "base/win/registry.h" | 14 #include "base/win/registry.h" |
14 #include "chrome/common/chrome_constants.h" | 15 #include "chrome/common/chrome_constants.h" |
15 #include "chrome/common/chrome_paths.h" | 16 #include "chrome/common/chrome_paths.h" |
16 #include "chrome/installer/util/browser_distribution.h" | 17 #include "chrome/installer/util/browser_distribution.h" |
17 #include "chrome/installer/util/google_update_constants.h" | 18 #include "chrome/installer/util/google_update_constants.h" |
18 #include "chrome/test/base/in_process_browser_test.h" | 19 #include "chrome/test/base/in_process_browser_test.h" |
19 #include "content/public/browser/browser_thread.h" | 20 #include "content/public/browser/browser_thread.h" |
20 | 21 |
21 namespace downgrade { | 22 namespace downgrade { |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 protected: | 109 protected: |
109 // InProcessBrowserTest: | 110 // InProcessBrowserTest: |
110 bool SetUpUserDataDirectory() override { | 111 bool SetUpUserDataDirectory() override { |
111 return CreateTemporaryFileInDir(user_data_dir_, &other_file_); | 112 return CreateTemporaryFileInDir(user_data_dir_, &other_file_); |
112 } | 113 } |
113 }; | 114 }; |
114 | 115 |
115 // Verify the user data directory has been renamed and created again after | 116 // Verify the user data directory has been renamed and created again after |
116 // downgrade. | 117 // downgrade. |
117 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserCopyAndCleanTest, Test) { | 118 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserCopyAndCleanTest, Test) { |
| 119 base::ThreadRestrictions::ScopedAllowIO allow_io; |
118 content::BrowserThread::GetBlockingPool()->FlushForTesting(); | 120 content::BrowserThread::GetBlockingPool()->FlushForTesting(); |
119 EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); | 121 EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); |
120 ASSERT_FALSE(base::PathExists(other_file_)); | 122 ASSERT_FALSE(base::PathExists(other_file_)); |
121 } | 123 } |
122 | 124 |
123 // Verify the user data directory will not be reset without downgrade. | 125 // Verify the user data directory will not be reset without downgrade. |
124 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoResetTest, Test) { | 126 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoResetTest, Test) { |
| 127 base::ThreadRestrictions::ScopedAllowIO allow_io; |
125 EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); | 128 EXPECT_EQ(chrome::kChromeVersion, GetLastVersion(user_data_dir_).GetString()); |
126 ASSERT_TRUE(base::PathExists(other_file_)); | 129 ASSERT_TRUE(base::PathExists(other_file_)); |
127 } | 130 } |
128 | 131 |
129 // Verify the "Last Version" file won't be created for non-msi install. | 132 // Verify the "Last Version" file won't be created for non-msi install. |
130 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { | 133 IN_PROC_BROWSER_TEST_F(UserDataDowngradeBrowserNoMSITest, Test) { |
| 134 base::ThreadRestrictions::ScopedAllowIO allow_io; |
131 ASSERT_FALSE(base::PathExists(last_version_file_path_)); | 135 ASSERT_FALSE(base::PathExists(last_version_file_path_)); |
132 ASSERT_TRUE(base::PathExists(other_file_)); | 136 ASSERT_TRUE(base::PathExists(other_file_)); |
133 } | 137 } |
134 | 138 |
135 } // namespace downgrade | 139 } // namespace downgrade |
OLD | NEW |