Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(42)

Side by Side Diff: chrome/browser/importer/firefox_importer_browsertest.cc

Issue 100573002: Move directory creation functions to base namespace. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/message_loop.h" 8 #include "base/message_loop/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 198 matching lines...) Expand 10 before | Expand all | Expand 10 after
209 // These tests need to be browser tests in order to be able to run the OOP 209 // These tests need to be browser tests in order to be able to run the OOP
210 // import (via ExternalProcessImporterHost) which launches a utility process on 210 // import (via ExternalProcessImporterHost) which launches a utility process on
211 // supported platforms. 211 // supported platforms.
212 class FirefoxProfileImporterBrowserTest : public InProcessBrowserTest { 212 class FirefoxProfileImporterBrowserTest : public InProcessBrowserTest {
213 protected: 213 protected:
214 virtual void SetUp() OVERRIDE { 214 virtual void SetUp() OVERRIDE {
215 // Creates a new profile in a new subdirectory in the temp directory. 215 // Creates a new profile in a new subdirectory in the temp directory.
216 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir()); 216 ASSERT_TRUE(temp_dir_.CreateUniqueTempDir());
217 base::FilePath test_path = temp_dir_.path().AppendASCII("ImporterTest"); 217 base::FilePath test_path = temp_dir_.path().AppendASCII("ImporterTest");
218 base::DeleteFile(test_path, true); 218 base::DeleteFile(test_path, true);
219 file_util::CreateDirectory(test_path); 219 base::CreateDirectory(test_path);
220 profile_path_ = test_path.AppendASCII("profile"); 220 profile_path_ = test_path.AppendASCII("profile");
221 app_path_ = test_path.AppendASCII("app"); 221 app_path_ = test_path.AppendASCII("app");
222 file_util::CreateDirectory(app_path_); 222 base::CreateDirectory(app_path_);
223 223
224 // This will launch the browser test and thus needs to happen last. 224 // This will launch the browser test and thus needs to happen last.
225 InProcessBrowserTest::SetUp(); 225 InProcessBrowserTest::SetUp();
226 } 226 }
227 227
228 void Firefox3xImporterBrowserTest( 228 void Firefox3xImporterBrowserTest(
229 std::string profile_dir, 229 std::string profile_dir,
230 importer::ImporterProgressObserver* observer, 230 importer::ImporterProgressObserver* observer,
231 ProfileWriter* writer, 231 ProfileWriter* writer,
232 bool import_search_plugins) { 232 bool import_search_plugins) {
233 base::FilePath data_path; 233 base::FilePath data_path;
234 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 234 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
235 data_path = data_path.AppendASCII(profile_dir); 235 data_path = data_path.AppendASCII(profile_dir);
236 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, true)); 236 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, true));
237 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 237 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
238 data_path = data_path.AppendASCII("firefox3_nss"); 238 data_path = data_path.AppendASCII("firefox3_nss");
239 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, false)); 239 ASSERT_TRUE(base::CopyDirectory(data_path, profile_path_, false));
240 240
241 base::FilePath search_engine_path = app_path_; 241 base::FilePath search_engine_path = app_path_;
242 search_engine_path = search_engine_path.AppendASCII("searchplugins"); 242 search_engine_path = search_engine_path.AppendASCII("searchplugins");
243 file_util::CreateDirectory(search_engine_path); 243 base::CreateDirectory(search_engine_path);
244 if (import_search_plugins) { 244 if (import_search_plugins) {
245 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 245 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
246 data_path = data_path.AppendASCII("firefox3_searchplugins"); 246 data_path = data_path.AppendASCII("firefox3_searchplugins");
247 if (!base::PathExists(data_path)) { 247 if (!base::PathExists(data_path)) {
248 // TODO(maruel): Create search test data that we can open source! 248 // TODO(maruel): Create search test data that we can open source!
249 LOG(ERROR) << L"Missing internal test data"; 249 LOG(ERROR) << L"Missing internal test data";
250 return; 250 return;
251 } 251 }
252 ASSERT_TRUE(base::CopyDirectory(data_path, search_engine_path, false)); 252 ASSERT_TRUE(base::CopyDirectory(data_path, search_engine_path, false));
253 } 253 }
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
285 } 285 }
286 286
287 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, 287 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest,
288 MAYBE_IMPORTER(Firefox35Importer)) { 288 MAYBE_IMPORTER(Firefox35Importer)) {
289 bool import_search_engines = false; 289 bool import_search_engines = false;
290 scoped_refptr<FirefoxObserver> observer( 290 scoped_refptr<FirefoxObserver> observer(
291 new FirefoxObserver(import_search_engines)); 291 new FirefoxObserver(import_search_engines));
292 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(), 292 Firefox3xImporterBrowserTest("firefox35_profile", observer.get(),
293 observer.get(), import_search_engines); 293 observer.get(), import_search_engines);
294 } 294 }
OLDNEW
« no previous file with comments | « chrome/browser/history/history_unittest.cc ('k') | chrome/browser/jumplist_win.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698