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 99 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
110 : ProfileWriter(NULL), bookmark_count_(0), history_count_(0), | 110 : ProfileWriter(NULL), bookmark_count_(0), history_count_(0), |
111 password_count_(0), keyword_count_(0), | 111 password_count_(0), keyword_count_(0), |
112 import_search_engines_(import_search_engines) { | 112 import_search_engines_(import_search_engines) { |
113 } | 113 } |
114 | 114 |
115 // importer::ImporterProgressObserver: | 115 // importer::ImporterProgressObserver: |
116 virtual void ImportStarted() OVERRIDE {} | 116 virtual void ImportStarted() OVERRIDE {} |
117 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} | 117 virtual void ImportItemStarted(importer::ImportItem item) OVERRIDE {} |
118 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} | 118 virtual void ImportItemEnded(importer::ImportItem item) OVERRIDE {} |
119 virtual void ImportEnded() OVERRIDE { | 119 virtual void ImportEnded() OVERRIDE { |
120 MessageLoop::current()->Quit(); | 120 base::MessageLoop::current()->Quit(); |
121 EXPECT_EQ(arraysize(kFirefox3Bookmarks), bookmark_count_); | 121 EXPECT_EQ(arraysize(kFirefox3Bookmarks), bookmark_count_); |
122 EXPECT_EQ(1U, history_count_); | 122 EXPECT_EQ(1U, history_count_); |
123 EXPECT_EQ(arraysize(kFirefox3Passwords), password_count_); | 123 EXPECT_EQ(arraysize(kFirefox3Passwords), password_count_); |
124 if (import_search_engines_) | 124 if (import_search_engines_) |
125 EXPECT_EQ(arraysize(kFirefox3Keywords), keyword_count_); | 125 EXPECT_EQ(arraysize(kFirefox3Keywords), keyword_count_); |
126 } | 126 } |
127 | 127 |
128 virtual bool BookmarkModelIsLoaded() const OVERRIDE { | 128 virtual bool BookmarkModelIsLoaded() const OVERRIDE { |
129 // Profile is ready for writing. | 129 // Profile is ready for writing. |
130 return true; | 130 return true; |
(...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
271 // TODO(gab): Use ExternalProcessImporterHost on Linux as well. | 271 // TODO(gab): Use ExternalProcessImporterHost on Linux as well. |
272 ImporterHost* host; | 272 ImporterHost* host; |
273 #if defined(OS_MACOSX) || defined(OS_WIN) | 273 #if defined(OS_MACOSX) || defined(OS_WIN) |
274 host = new ExternalProcessImporterHost; | 274 host = new ExternalProcessImporterHost; |
275 #else | 275 #else |
276 host = new ImporterHost; | 276 host = new ImporterHost; |
277 #endif | 277 #endif |
278 host->SetObserver(observer); | 278 host->SetObserver(observer); |
279 host->StartImportSettings(source_profile, browser()->profile(), | 279 host->StartImportSettings(source_profile, browser()->profile(), |
280 items, make_scoped_refptr(writer)); | 280 items, make_scoped_refptr(writer)); |
281 MessageLoop::current()->Run(); | 281 base::MessageLoop::current()->Run(); |
282 } | 282 } |
283 | 283 |
284 base::ScopedTempDir temp_dir_; | 284 base::ScopedTempDir temp_dir_; |
285 base::FilePath profile_path_; | 285 base::FilePath profile_path_; |
286 base::FilePath app_path_; | 286 base::FilePath app_path_; |
287 }; | 287 }; |
288 | 288 |
289 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 289 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
290 MAYBE_IMPORTER(Firefox30Importer)) { | 290 MAYBE_IMPORTER(Firefox30Importer)) { |
291 scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); | 291 scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); |
292 Firefox3xImporterBrowserTest("firefox3_profile", observer.get(), | 292 Firefox3xImporterBrowserTest("firefox3_profile", observer.get(), |
293 observer.get(), true); | 293 observer.get(), true); |
294 } | 294 } |
295 | 295 |
296 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 296 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
297 MAYBE_IMPORTER(Firefox35Importer)) { | 297 MAYBE_IMPORTER(Firefox35Importer)) { |
298 bool import_search_engines = false; | 298 bool import_search_engines = false; |
299 scoped_refptr<Firefox3Observer> observer( | 299 scoped_refptr<Firefox3Observer> observer( |
300 new Firefox3Observer(import_search_engines)); | 300 new Firefox3Observer(import_search_engines)); |
301 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), | 301 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), |
302 observer.get(), import_search_engines); | 302 observer.get(), import_search_engines); |
303 } | 303 } |
OLD | NEW |