| 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 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 } | 231 } |
| 232 | 232 |
| 233 void Firefox3xImporterBrowserTest( | 233 void Firefox3xImporterBrowserTest( |
| 234 std::string profile_dir, | 234 std::string profile_dir, |
| 235 importer::ImporterProgressObserver* observer, | 235 importer::ImporterProgressObserver* observer, |
| 236 ProfileWriter* writer, | 236 ProfileWriter* writer, |
| 237 bool import_search_plugins) { | 237 bool import_search_plugins) { |
| 238 base::FilePath data_path; | 238 base::FilePath data_path; |
| 239 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 239 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| 240 data_path = data_path.AppendASCII(profile_dir); | 240 data_path = data_path.AppendASCII(profile_dir); |
| 241 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true)); | 241 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, true)); |
| 242 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 242 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| 243 data_path = data_path.AppendASCII("firefox3_nss"); | 243 data_path = data_path.AppendASCII("firefox3_nss"); |
| 244 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false)); | 244 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, false)); |
| 245 | 245 |
| 246 base::FilePath search_engine_path = app_path_; | 246 base::FilePath search_engine_path = app_path_; |
| 247 search_engine_path = search_engine_path.AppendASCII("searchplugins"); | 247 search_engine_path = search_engine_path.AppendASCII("searchplugins"); |
| 248 file_util::CreateDirectory(search_engine_path); | 248 file_util::CreateDirectory(search_engine_path); |
| 249 if (import_search_plugins) { | 249 if (import_search_plugins) { |
| 250 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); | 250 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); |
| 251 data_path = data_path.AppendASCII("firefox3_searchplugins"); | 251 data_path = data_path.AppendASCII("firefox3_searchplugins"); |
| 252 if (!file_util::PathExists(data_path)) { | 252 if (!file_util::PathExists(data_path)) { |
| 253 // TODO(maruel): Create search test data that we can open source! | 253 // TODO(maruel): Create search test data that we can open source! |
| 254 LOG(ERROR) << L"Missing internal test data"; | 254 LOG(ERROR) << L"Missing internal test data"; |
| 255 return; | 255 return; |
| 256 } | 256 } |
| 257 ASSERT_TRUE(file_util::CopyDirectory(data_path, | 257 ASSERT_TRUE(base::CopyDirectory(data_path, search_engine_path, false)); |
| 258 search_engine_path, false)); | |
| 259 } | 258 } |
| 260 | 259 |
| 261 importer::SourceProfile source_profile; | 260 importer::SourceProfile source_profile; |
| 262 source_profile.importer_type = importer::TYPE_FIREFOX3; | 261 source_profile.importer_type = importer::TYPE_FIREFOX3; |
| 263 source_profile.app_path = app_path_; | 262 source_profile.app_path = app_path_; |
| 264 source_profile.source_path = profile_path_; | 263 source_profile.source_path = profile_path_; |
| 265 source_profile.locale = "en-US"; | 264 source_profile.locale = "en-US"; |
| 266 | 265 |
| 267 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; | 266 int items = importer::HISTORY | importer::PASSWORDS | importer::FAVORITES; |
| 268 if (import_search_plugins) | 267 if (import_search_plugins) |
| (...skipping 22 matching lines...) Expand all Loading... |
| 291 } | 290 } |
| 292 | 291 |
| 293 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, | 292 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, |
| 294 MAYBE_IMPORTER(Firefox35Importer)) { | 293 MAYBE_IMPORTER(Firefox35Importer)) { |
| 295 bool import_search_engines = false; | 294 bool import_search_engines = false; |
| 296 scoped_refptr<Firefox3Observer> observer( | 295 scoped_refptr<Firefox3Observer> observer( |
| 297 new Firefox3Observer(import_search_engines)); | 296 new Firefox3Observer(import_search_engines)); |
| 298 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), | 297 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), |
| 299 observer.get(), import_search_engines); | 298 observer.get(), import_search_engines); |
| 300 } | 299 } |
| OLD | NEW |