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

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

Issue 276016: Remove some deprecated file_util wstring functions. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: lint Created 11 years, 2 months 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/importer/firefox3_importer.cc ('k') | chrome/browser/jumplist.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) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <windows.h> 7 #include <windows.h>
8 #include <unknwn.h> 8 #include <unknwn.h>
9 #include <intshcut.h> 9 #include <intshcut.h>
10 #include <pstore.h> 10 #include <pstore.h>
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
42 file_util::AppendToPath(&profile_path_, L"profile"); 42 file_util::AppendToPath(&profile_path_, L"profile");
43 CreateDirectory(profile_path_.c_str(), NULL); 43 CreateDirectory(profile_path_.c_str(), NULL);
44 app_path_ = test_path_; 44 app_path_ = test_path_;
45 file_util::AppendToPath(&app_path_, L"app"); 45 file_util::AppendToPath(&app_path_, L"app");
46 CreateDirectory(app_path_.c_str(), NULL); 46 CreateDirectory(app_path_.c_str(), NULL);
47 } 47 }
48 48
49 virtual void TearDown() { 49 virtual void TearDown() {
50 // Deletes the profile and cleans up the profile directory. 50 // Deletes the profile and cleans up the profile directory.
51 ASSERT_TRUE(file_util::Delete(test_path_, true)); 51 ASSERT_TRUE(file_util::Delete(test_path_, true));
52 ASSERT_FALSE(file_util::PathExists(test_path_)); 52 ASSERT_FALSE(file_util::PathExists(FilePath::FromWStringHack(test_path_)));
53 } 53 }
54 54
55 void Firefox3xImporterTest(std::wstring profile_dir, 55 void Firefox3xImporterTest(std::wstring profile_dir,
56 ImporterHost::Observer* observer, 56 ImporterHost::Observer* observer,
57 ProfileWriter* writer, 57 ProfileWriter* writer,
58 bool import_search_plugins) { 58 bool import_search_plugins) {
59 std::wstring data_path; 59 std::wstring data_path;
60 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 60 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
61 file_util::AppendToPath(&data_path, profile_dir + L"\\*"); 61 file_util::AppendToPath(&data_path, profile_dir + L"\\*");
62 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true)); 62 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true));
63 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 63 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
64 file_util::AppendToPath(&data_path, L"firefox3_nss"); 64 file_util::AppendToPath(&data_path, L"firefox3_nss");
65 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false)); 65 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false));
66 66
67 std::wstring search_engine_path = app_path_; 67 std::wstring search_engine_path = app_path_;
68 file_util::AppendToPath(&search_engine_path, L"searchplugins"); 68 file_util::AppendToPath(&search_engine_path, L"searchplugins");
69 CreateDirectory(search_engine_path.c_str(), NULL); 69 CreateDirectory(search_engine_path.c_str(), NULL);
70 if (import_search_plugins) { 70 if (import_search_plugins) {
71 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 71 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
72 file_util::AppendToPath(&data_path, L"firefox3_searchplugins"); 72 file_util::AppendToPath(&data_path, L"firefox3_searchplugins");
73 if (!file_util::PathExists(data_path)) { 73 if (!file_util::PathExists(FilePath::FromWStringHack(data_path))) {
74 // TODO(maruel): Create search test data that we can open source! 74 // TODO(maruel): Create search test data that we can open source!
75 LOG(ERROR) << L"Missing internal test data"; 75 LOG(ERROR) << L"Missing internal test data";
76 return; 76 return;
77 } 77 }
78 ASSERT_TRUE(file_util::CopyDirectory(data_path, 78 ASSERT_TRUE(file_util::CopyDirectory(data_path,
79 search_engine_path, false)); 79 search_engine_path, false));
80 } 80 }
81 81
82 MessageLoop* loop = MessageLoop::current(); 82 MessageLoop* loop = MessageLoop::current();
83 ProfileInfo profile_info; 83 ProfileInfo profile_info;
(...skipping 555 matching lines...) Expand 10 before | Expand all | Expand 10 after
639 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true)); 639 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, true));
640 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 640 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
641 file_util::AppendToPath(&data_path, L"firefox2_nss"); 641 file_util::AppendToPath(&data_path, L"firefox2_nss");
642 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false)); 642 ASSERT_TRUE(file_util::CopyDirectory(data_path, profile_path_, false));
643 643
644 std::wstring search_engine_path = app_path_; 644 std::wstring search_engine_path = app_path_;
645 file_util::AppendToPath(&search_engine_path, L"searchplugins"); 645 file_util::AppendToPath(&search_engine_path, L"searchplugins");
646 CreateDirectory(search_engine_path.c_str(), NULL); 646 CreateDirectory(search_engine_path.c_str(), NULL);
647 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 647 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
648 file_util::AppendToPath(&data_path, L"firefox2_searchplugins"); 648 file_util::AppendToPath(&data_path, L"firefox2_searchplugins");
649 if (!file_util::PathExists(data_path)) { 649 if (!file_util::PathExists(FilePath::FromWStringHack(data_path))) {
650 // TODO(maruel): Create test data that we can open source! 650 // TODO(maruel): Create test data that we can open source!
651 LOG(ERROR) << L"Missing internal test data"; 651 LOG(ERROR) << L"Missing internal test data";
652 return; 652 return;
653 } 653 }
654 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false)); 654 ASSERT_TRUE(file_util::CopyDirectory(data_path, search_engine_path, false));
655 655
656 MessageLoop* loop = MessageLoop::current(); 656 MessageLoop* loop = MessageLoop::current();
657 scoped_refptr<ImporterHost> host = new ImporterHost(loop); 657 scoped_refptr<ImporterHost> host = new ImporterHost(loop);
658 FirefoxObserver* observer = new FirefoxObserver(); 658 FirefoxObserver* observer = new FirefoxObserver();
659 host->SetObserver(observer); 659 host->SetObserver(observer);
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
843 true); 843 true);
844 } 844 }
845 845
846 TEST_F(ImporterTest, Firefox35Importer) { 846 TEST_F(ImporterTest, Firefox35Importer) {
847 bool import_search_engines = false; 847 bool import_search_engines = false;
848 scoped_refptr<Firefox3Observer> observer = 848 scoped_refptr<Firefox3Observer> observer =
849 new Firefox3Observer(import_search_engines); 849 new Firefox3Observer(import_search_engines);
850 Firefox3xImporterTest(L"firefox35_profile", observer.get(), observer.get(), 850 Firefox3xImporterTest(L"firefox35_profile", observer.get(), observer.get(),
851 import_search_engines); 851 import_search_engines);
852 } 852 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/firefox3_importer.cc ('k') | chrome/browser/jumplist.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698