| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "testing/gtest/include/gtest/gtest.h" | 5 #include "testing/gtest/include/gtest/gtest.h" |
| 6 | 6 |
| 7 #include "build/build_config.h" | 7 #include "build/build_config.h" |
| 8 | 8 |
| 9 #if defined(OS_WIN) | 9 #if defined(OS_WIN) |
| 10 #include <windows.h> | 10 #include <windows.h> |
| (...skipping 102 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 113 MessageLoop* loop = MessageLoop::current(); | 113 MessageLoop* loop = MessageLoop::current(); |
| 114 ProfileInfo profile_info; | 114 ProfileInfo profile_info; |
| 115 profile_info.browser_type = FIREFOX3; | 115 profile_info.browser_type = FIREFOX3; |
| 116 profile_info.app_path = app_path_; | 116 profile_info.app_path = app_path_; |
| 117 profile_info.source_path = profile_path_; | 117 profile_info.source_path = profile_path_; |
| 118 scoped_refptr<ImporterHost> host = new ImporterHost(); | 118 scoped_refptr<ImporterHost> host = new ImporterHost(); |
| 119 host->SetObserver(observer); | 119 host->SetObserver(observer); |
| 120 int items = HISTORY | PASSWORDS | FAVORITES; | 120 int items = HISTORY | PASSWORDS | FAVORITES; |
| 121 if (import_search_plugins) | 121 if (import_search_plugins) |
| 122 items = items | SEARCH_ENGINES; | 122 items = items | SEARCH_ENGINES; |
| 123 loop->PostTask( | 123 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), |
| 124 FROM_HERE, | 124 &ImporterHost::StartImportSettings, profile_info, |
| 125 NewRunnableMethod(host.get(), | 125 static_cast<Profile*>(NULL), items, writer, true)); |
| 126 &ImporterHost::StartImportSettings, | |
| 127 profile_info, | |
| 128 static_cast<Profile*>(NULL), | |
| 129 items, | |
| 130 make_scoped_refptr(writer), | |
| 131 true)); | |
| 132 loop->Run(); | 126 loop->Run(); |
| 133 } | 127 } |
| 134 | 128 |
| 135 MessageLoopForUI message_loop_; | 129 MessageLoopForUI message_loop_; |
| 136 ChromeThread ui_thread_; | 130 ChromeThread ui_thread_; |
| 137 ChromeThread file_thread_; | 131 ChromeThread file_thread_; |
| 138 FilePath test_path_; | 132 FilePath test_path_; |
| 139 FilePath profile_path_; | 133 FilePath profile_path_; |
| 140 FilePath app_path_; | 134 FilePath app_path_; |
| 141 }; | 135 }; |
| (...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 697 data_path = data_path.AppendASCII("firefox2_searchplugins"); | 691 data_path = data_path.AppendASCII("firefox2_searchplugins"); |
| 698 if (!file_util::PathExists(data_path)) { | 692 if (!file_util::PathExists(data_path)) { |
| 699 // TODO(maruel): Create test data that we can open source! | 693 // TODO(maruel): Create test data that we can open source! |
| 700 LOG(ERROR) << L"Missing internal test data"; | 694 LOG(ERROR) << L"Missing internal test data"; |
| 701 return; | 695 return; |
| 702 } | 696 } |
| 703 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); | 697 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); |
| 704 | 698 |
| 705 MessageLoop* loop = MessageLoop::current(); | 699 MessageLoop* loop = MessageLoop::current(); |
| 706 scoped_refptr<ImporterHost> host = new ImporterHost(); | 700 scoped_refptr<ImporterHost> host = new ImporterHost(); |
| 707 scoped_refptr<FirefoxObserver> observer = new FirefoxObserver(); | 701 FirefoxObserver* observer = new FirefoxObserver(); |
| 708 host->SetObserver(observer); | 702 host->SetObserver(observer); |
| 709 ProfileInfo profile_info; | 703 ProfileInfo profile_info; |
| 710 profile_info.browser_type = FIREFOX2; | 704 profile_info.browser_type = FIREFOX2; |
| 711 profile_info.app_path = app_path_; | 705 profile_info.app_path = app_path_; |
| 712 profile_info.source_path = profile_path_; | 706 profile_info.source_path = profile_path_; |
| 713 | 707 |
| 714 loop->PostTask( | 708 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), |
| 715 FROM_HERE, | 709 &ImporterHost::StartImportSettings, profile_info, |
| 716 NewRunnableMethod( | 710 static_cast<Profile*>(NULL), |
| 717 host.get(), | 711 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); |
| 718 &ImporterHost::StartImportSettings, | |
| 719 profile_info, | |
| 720 static_cast<Profile*>(NULL), | |
| 721 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, | |
| 722 observer, | |
| 723 true)); | |
| 724 loop->Run(); | 712 loop->Run(); |
| 725 } | 713 } |
| 726 | 714 |
| 727 static const BookmarkList kFirefox3Bookmarks[] = { | 715 static const BookmarkList kFirefox3Bookmarks[] = { |
| 728 {true, 0, {}, | 716 {true, 0, {}, |
| 729 L"Toolbar", | 717 L"Toolbar", |
| 730 "http://site/"}, | 718 "http://site/"}, |
| 731 {false, 0, {}, | 719 {false, 0, {}, |
| 732 L"Title", | 720 L"Title", |
| 733 "http://www.google.com/"}, | 721 "http://www.google.com/"}, |
| (...skipping 163 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 897 true); | 885 true); |
| 898 } | 886 } |
| 899 | 887 |
| 900 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { | 888 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { |
| 901 bool import_search_engines = false; | 889 bool import_search_engines = false; |
| 902 scoped_refptr<Firefox3Observer> observer = | 890 scoped_refptr<Firefox3Observer> observer = |
| 903 new Firefox3Observer(import_search_engines); | 891 new Firefox3Observer(import_search_engines); |
| 904 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 892 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
| 905 import_search_engines); | 893 import_search_engines); |
| 906 } | 894 } |
| OLD | NEW |