OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/file_util.h" | 5 #include "base/file_util.h" |
6 #include "base/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/files/scoped_temp_dir.h" | 7 #include "base/files/scoped_temp_dir.h" |
8 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
262 source_profile.importer_type = importer::TYPE_FIREFOX3; | 262 source_profile.importer_type = importer::TYPE_FIREFOX3; |
263 source_profile.app_path = app_path_; | 263 source_profile.app_path = app_path_; |
264 source_profile.source_path = profile_path_; | 264 source_profile.source_path = profile_path_; |
265 source_profile.locale = "en-US"; | 265 source_profile.locale = "en-US"; |
266 | 266 |
267 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; | 267 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; |
268 if (import_search_plugins) | 268 if (import_search_plugins) |
269 items = items | importer::SEARCH_ENGINES; | 269 items = items | importer::SEARCH_ENGINES; |
270 | 270 |
271 // Deletes itself. | 271 // Deletes itself. |
272 // TODO(gab): Use ExternalProcessImporterHost on Linux as well. | 272 ImporterHost* host = new ExternalProcessImporterHost; |
273 ImporterHost* host; | |
274 #if defined(OS_MACOSX) || defined(OS_WIN) | |
275 host = new ExternalProcessImporterHost; | |
276 #else | |
277 host = new ImporterHost; | |
278 #endif | |
279 host->SetObserver(observer); | 273 host->SetObserver(observer); |
280 host->StartImportSettings(source_profile, browser()->profile(), | 274 host->StartImportSettings(source_profile, browser()->profile(), |
281 items, make_scoped_refptr(writer)); | 275 items, make_scoped_refptr(writer)); |
282 MessageLoop::current()->Run(); | 276 MessageLoop::current()->Run(); |
283 } | 277 } |
284 | 278 |
285 base::ScopedTempDir temp_dir_; | 279 base::ScopedTempDir temp_dir_; |
286 base::FilePath profile_path_; | 280 base::FilePath profile_path_; |
287 base::FilePath app_path_; | 281 base::FilePath app_path_; |
288 }; | 282 }; |
289 | 283 |
290 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 284 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
291 MAYBE_IMPORTER(Firefox30Importer)) { | 285 MAYBE_IMPORTER(Firefox30Importer)) { |
292 scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); | 286 scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); |
293 Firefox3xImporterBrowserTest("firefox3_profile", observer.get(), | 287 Firefox3xImporterBrowserTest("firefox3_profile", observer.get(), |
294 observer.get(), true); | 288 observer.get(), true); |
295 } | 289 } |
296 | 290 |
297 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 291 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
298 MAYBE_IMPORTER(Firefox35Importer)) { | 292 MAYBE_IMPORTER(Firefox35Importer)) { |
299 bool import_search_engines = false; | 293 bool import_search_engines = false; |
300 scoped_refptr<Firefox3Observer> observer( | 294 scoped_refptr<Firefox3Observer> observer( |
301 new Firefox3Observer(import_search_engines)); | 295 new Firefox3Observer(import_search_engines)); |
302 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), | 296 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), |
303 observer.get(), import_search_engines); | 297 observer.get(), import_search_engines); |
304 } | 298 } |
OLD | NEW |