OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/prefs/pref_service.h" | 7 #include "base/prefs/pref_service.h" |
8 #include "base/strings/string_util.h" | 8 #include "base/strings/string_util.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "chrome/browser/browser_process.h" | 10 #include "chrome/browser/browser_process.h" |
(...skipping 131 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
142 #define MAYBE_ImportDefault ImportDefault | 142 #define MAYBE_ImportDefault ImportDefault |
143 #endif | 143 #endif |
144 | 144 |
145 extern const char kImportDefault[] = | 145 extern const char kImportDefault[] = |
146 "{\n" | 146 "{\n" |
147 "}\n"; | 147 "}\n"; |
148 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault> | 148 typedef FirstRunMasterPrefsBrowserTestT<kImportDefault> |
149 FirstRunMasterPrefsImportDefault; | 149 FirstRunMasterPrefsImportDefault; |
150 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) { | 150 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportDefault, MAYBE_ImportDefault) { |
151 int auto_import_state = first_run::auto_import_state(); | 151 int auto_import_state = first_run::auto_import_state(); |
152 // Aura builds skip over the import process. | |
153 #if defined(USE_AURA) | |
154 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, auto_import_state); | |
155 #else | |
156 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED | | 152 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED | |
157 first_run::AUTO_IMPORT_PROFILE_IMPORTED, | 153 first_run::AUTO_IMPORT_PROFILE_IMPORTED, |
158 auto_import_state); | 154 auto_import_state); |
159 #endif | |
160 } | 155 } |
161 | 156 |
162 // TODO(tapted): Investigate why this fails on Linux bots but does not | 157 // TODO(tapted): Investigate why this fails on Linux bots but does not |
163 // reproduce locally. See http://crbug.com/178062 . | 158 // reproduce locally. See http://crbug.com/178062 . |
164 // TODO(tapted): Investigate why this fails on mac_asan flakily | 159 // TODO(tapted): Investigate why this fails on mac_asan flakily |
165 // http://crbug.com/181499 . | 160 // http://crbug.com/181499 . |
166 #if defined(OS_LINUX) || (defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)) | 161 #if defined(OS_LINUX) || (defined(OS_MACOSX) && defined(ADDRESS_SANITIZER)) |
167 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile | 162 #define MAYBE_ImportBookmarksFile DISABLED_ImportBookmarksFile |
168 #else | 163 #else |
169 #define MAYBE_ImportBookmarksFile ImportBookmarksFile | 164 #define MAYBE_ImportBookmarksFile ImportBookmarksFile |
170 #endif | 165 #endif |
171 | 166 |
172 // The bookmarks file doesn't actually need to exist for this integration test | 167 // The bookmarks file doesn't actually need to exist for this integration test |
173 // to trigger the interaction being tested. | 168 // to trigger the interaction being tested. |
174 extern const char kImportBookmarksFile[] = | 169 extern const char kImportBookmarksFile[] = |
175 "{\n" | 170 "{\n" |
176 " \"distribution\": {\n" | 171 " \"distribution\": {\n" |
177 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n" | 172 " \"import_bookmarks_from_file\": \"/foo/doesntexists.wtv\"\n" |
178 " }\n" | 173 " }\n" |
179 "}\n"; | 174 "}\n"; |
180 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile> | 175 typedef FirstRunMasterPrefsBrowserTestT<kImportBookmarksFile> |
181 FirstRunMasterPrefsImportBookmarksFile; | 176 FirstRunMasterPrefsImportBookmarksFile; |
182 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile, | 177 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportBookmarksFile, |
183 MAYBE_ImportBookmarksFile) { | 178 MAYBE_ImportBookmarksFile) { |
184 int auto_import_state = first_run::auto_import_state(); | 179 int auto_import_state = first_run::auto_import_state(); |
185 // Aura builds skip over the import process. | |
186 #if defined(USE_AURA) | |
187 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, auto_import_state); | |
188 #else | |
189 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED | | 180 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED | |
190 first_run::AUTO_IMPORT_PROFILE_IMPORTED | | 181 first_run::AUTO_IMPORT_PROFILE_IMPORTED | |
191 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED, | 182 first_run::AUTO_IMPORT_BOOKMARKS_FILE_IMPORTED, |
192 auto_import_state); | 183 auto_import_state); |
193 #endif | |
194 } | 184 } |
195 | 185 |
196 // Test an import with all import options disabled. This is a regression test | 186 // Test an import with all import options disabled. This is a regression test |
197 // for http://crbug.com/169984 where this would cause the import process to | 187 // for http://crbug.com/169984 where this would cause the import process to |
198 // stay running, and the NTP to be loaded with no apps. | 188 // stay running, and the NTP to be loaded with no apps. |
199 extern const char kImportNothing[] = | 189 extern const char kImportNothing[] = |
200 "{\n" | 190 "{\n" |
201 " \"distribution\": {\n" | 191 " \"distribution\": {\n" |
202 " \"import_bookmarks\": false,\n" | 192 " \"import_bookmarks\": false,\n" |
203 " \"import_history\": false,\n" | 193 " \"import_history\": false,\n" |
204 " \"import_home_page\": false,\n" | 194 " \"import_home_page\": false,\n" |
205 " \"import_search_engine\": false\n" | 195 " \"import_search_engine\": false\n" |
206 " }\n" | 196 " }\n" |
207 "}\n"; | 197 "}\n"; |
208 typedef FirstRunMasterPrefsBrowserTestT<kImportNothing> | 198 typedef FirstRunMasterPrefsBrowserTestT<kImportNothing> |
209 FirstRunMasterPrefsImportNothing; | 199 FirstRunMasterPrefsImportNothing; |
210 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportNothing, | 200 IN_PROC_BROWSER_TEST_F(FirstRunMasterPrefsImportNothing, |
211 ImportNothingAndShowNewTabPage) { | 201 ImportNothingAndShowNewTabPage) { |
212 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, first_run::auto_import_state()); | 202 EXPECT_EQ(first_run::AUTO_IMPORT_CALLED, first_run::auto_import_state()); |
213 ui_test_utils::NavigateToURLWithDisposition( | 203 ui_test_utils::NavigateToURLWithDisposition( |
214 browser(), GURL(chrome::kChromeUINewTabURL), CURRENT_TAB, | 204 browser(), GURL(chrome::kChromeUINewTabURL), CURRENT_TAB, |
215 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 205 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
216 content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0); | 206 content::WebContents* tab = browser()->tab_strip_model()->GetWebContentsAt(0); |
217 EXPECT_EQ(1, tab->GetMaxPageID()); | 207 EXPECT_EQ(1, tab->GetMaxPageID()); |
218 } | 208 } |
219 | 209 |
220 #endif // !defined(OS_CHROMEOS) | 210 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |