| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 } | 108 } |
| 109 ASSERT_TRUE(file_util::CopyDirectory(data_path, | 109 ASSERT_TRUE(file_util::CopyDirectory(data_path, |
| 110 search_engine_path, false)); | 110 search_engine_path, false)); |
| 111 } | 111 } |
| 112 | 112 |
| 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(FROM_HERE, NewRunnableMethod(host.get(), | 123 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), |
| 124 &ImporterHost::StartImportSettings, profile_info, | 124 &ImporterHost::StartImportSettings, profile_info, |
| 125 static_cast<Profile*>(NULL), items, writer, true)); | 125 static_cast<Profile*>(NULL), items, writer, true)); |
| 126 loop->Run(); | 126 loop->Run(); |
| 127 } | 127 } |
| 128 | 128 |
| (...skipping 561 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 690 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 690 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| 691 data_path = data_path.AppendASCII("firefox2_searchplugins"); | 691 data_path = data_path.AppendASCII("firefox2_searchplugins"); |
| 692 if (!file_util::PathExists(data_path)) { | 692 if (!file_util::PathExists(data_path)) { |
| 693 // TODO(maruel): Create test data that we can open source! | 693 // TODO(maruel): Create test data that we can open source! |
| 694 LOG(ERROR) << L"Missing internal test data"; | 694 LOG(ERROR) << L"Missing internal test data"; |
| 695 return; | 695 return; |
| 696 } | 696 } |
| 697 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); | 697 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); |
| 698 | 698 |
| 699 MessageLoop* loop = MessageLoop::current(); | 699 MessageLoop* loop = MessageLoop::current(); |
| 700 scoped_refptr<ImporterHost> host = new ImporterHost(); | 700 scoped_refptr<ImporterHost> host(new ImporterHost()); |
| 701 FirefoxObserver* observer = new FirefoxObserver(); | 701 FirefoxObserver* observer = new FirefoxObserver(); |
| 702 host->SetObserver(observer); | 702 host->SetObserver(observer); |
| 703 ProfileInfo profile_info; | 703 ProfileInfo profile_info; |
| 704 profile_info.browser_type = FIREFOX2; | 704 profile_info.browser_type = FIREFOX2; |
| 705 profile_info.app_path = app_path_; | 705 profile_info.app_path = app_path_; |
| 706 profile_info.source_path = profile_path_; | 706 profile_info.source_path = profile_path_; |
| 707 | 707 |
| 708 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), | 708 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), |
| 709 &ImporterHost::StartImportSettings, profile_info, | 709 &ImporterHost::StartImportSettings, profile_info, |
| 710 static_cast<Profile*>(NULL), | 710 static_cast<Profile*>(NULL), |
| (...skipping 162 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 873 size_t bookmark_count_; | 873 size_t bookmark_count_; |
| 874 size_t history_count_; | 874 size_t history_count_; |
| 875 size_t password_count_; | 875 size_t password_count_; |
| 876 size_t keyword_count_; | 876 size_t keyword_count_; |
| 877 bool import_search_engines_; | 877 bool import_search_engines_; |
| 878 std::wstring default_keyword_; | 878 std::wstring default_keyword_; |
| 879 std::string default_keyword_url_; | 879 std::string default_keyword_url_; |
| 880 }; | 880 }; |
| 881 | 881 |
| 882 TEST_F(ImporterTest, MAYBE(Firefox30Importer)) { | 882 TEST_F(ImporterTest, MAYBE(Firefox30Importer)) { |
| 883 scoped_refptr<Firefox3Observer> observer = new Firefox3Observer(); | 883 scoped_refptr<Firefox3Observer> observer(new Firefox3Observer()); |
| 884 Firefox3xImporterTest("firefox3_profile", observer.get(), observer.get(), | 884 Firefox3xImporterTest("firefox3_profile", observer.get(), observer.get(), |
| 885 true); | 885 true); |
| 886 } | 886 } |
| 887 | 887 |
| 888 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { | 888 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { |
| 889 bool import_search_engines = false; | 889 bool import_search_engines = false; |
| 890 scoped_refptr<Firefox3Observer> observer = | 890 scoped_refptr<Firefox3Observer> observer( |
| 891 new Firefox3Observer(import_search_engines); | 891 new Firefox3Observer(import_search_engines)); |
| 892 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 892 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
| 893 import_search_engines); | 893 import_search_engines); |
| 894 } | 894 } |
| OLD | NEW |