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