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

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

Issue 9416: Make the test "pass" when the internal data is not found. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 12 years, 1 month 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 | « no previous file | no next file » | 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 579 matching lines...) Expand 10 before | Expand all | Expand 10 after
590 int password_count_; 590 int password_count_;
591 int keyword_count_; 591 int keyword_count_;
592 std::wstring default_keyword_; 592 std::wstring default_keyword_;
593 std::wstring default_keyword_url_; 593 std::wstring default_keyword_url_;
594 }; 594 };
595 595
596 TEST_F(ImporterTest, Firefox2Importer) { 596 TEST_F(ImporterTest, Firefox2Importer) {
597 std::wstring data_path; 597 std::wstring data_path;
598 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 598 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
599 file_util::AppendToPath(&data_path, L"firefox2_profile\\*"); 599 file_util::AppendToPath(&data_path, L"firefox2_profile\\*");
600 if (!file_util::PathExists(data_path)) {
601 LOG(ERROR) << L"Missing internal test data";
602 return;
603 }
600 file_util::CopyDirectory(data_path, profile_path_, true); 604 file_util::CopyDirectory(data_path, profile_path_, true);
601 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 605 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
602 file_util::AppendToPath(&data_path, L"firefox2_nss"); 606 file_util::AppendToPath(&data_path, L"firefox2_nss");
603 file_util::CopyDirectory(data_path, profile_path_, false); 607 file_util::CopyDirectory(data_path, profile_path_, false);
604 608
605 std::wstring search_engine_path = app_path_; 609 std::wstring search_engine_path = app_path_;
606 file_util::AppendToPath(&search_engine_path, L"searchplugins"); 610 file_util::AppendToPath(&search_engine_path, L"searchplugins");
607 CreateDirectory(search_engine_path.c_str(), NULL); 611 CreateDirectory(search_engine_path.c_str(), NULL);
608 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 612 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
609 file_util::AppendToPath(&data_path, L"firefox2_searchplugins"); 613 file_util::AppendToPath(&data_path, L"firefox2_searchplugins");
(...skipping 175 matching lines...) Expand 10 before | Expand all | Expand 10 after
785 int password_count_; 789 int password_count_;
786 int keyword_count_; 790 int keyword_count_;
787 std::wstring default_keyword_; 791 std::wstring default_keyword_;
788 std::wstring default_keyword_url_; 792 std::wstring default_keyword_url_;
789 }; 793 };
790 794
791 TEST_F(ImporterTest, Firefox3Importer) { 795 TEST_F(ImporterTest, Firefox3Importer) {
792 std::wstring data_path; 796 std::wstring data_path;
793 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 797 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
794 file_util::AppendToPath(&data_path, L"firefox3_profile\\*"); 798 file_util::AppendToPath(&data_path, L"firefox3_profile\\*");
799 if (!file_util::PathExists(data_path)) {
800 LOG(ERROR) << L"Missing internal test data";
801 return;
802 }
795 file_util::CopyDirectory(data_path, profile_path_, true); 803 file_util::CopyDirectory(data_path, profile_path_, true);
796 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 804 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
797 file_util::AppendToPath(&data_path, L"firefox3_nss"); 805 file_util::AppendToPath(&data_path, L"firefox3_nss");
798 file_util::CopyDirectory(data_path, profile_path_, false); 806 file_util::CopyDirectory(data_path, profile_path_, false);
799 807
800 std::wstring search_engine_path = app_path_; 808 std::wstring search_engine_path = app_path_;
801 file_util::AppendToPath(&search_engine_path, L"searchplugins"); 809 file_util::AppendToPath(&search_engine_path, L"searchplugins");
802 CreateDirectory(search_engine_path.c_str(), NULL); 810 CreateDirectory(search_engine_path.c_str(), NULL);
803 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path)); 811 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &data_path));
804 file_util::AppendToPath(&data_path, L"firefox3_searchplugins"); 812 file_util::AppendToPath(&data_path, L"firefox3_searchplugins");
805 file_util::CopyDirectory(data_path, search_engine_path, false); 813 file_util::CopyDirectory(data_path, search_engine_path, false);
806 814
807 MessageLoop* loop = MessageLoop::current(); 815 MessageLoop* loop = MessageLoop::current();
808 ProfileInfo profile_info; 816 ProfileInfo profile_info;
809 profile_info.browser_type = FIREFOX3; 817 profile_info.browser_type = FIREFOX3;
810 profile_info.app_path = app_path_; 818 profile_info.app_path = app_path_;
811 profile_info.source_path = profile_path_; 819 profile_info.source_path = profile_path_;
812 scoped_refptr<ImporterHost> host = new ImporterHost(loop); 820 scoped_refptr<ImporterHost> host = new ImporterHost(loop);
813 Firefox3Observer* observer = new Firefox3Observer(); 821 Firefox3Observer* observer = new Firefox3Observer();
814 host->SetObserver(observer); 822 host->SetObserver(observer);
815 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), 823 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(),
816 &ImporterHost::StartImportSettings, profile_info, 824 &ImporterHost::StartImportSettings, profile_info,
817 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); 825 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true));
818 loop->Run(); 826 loop->Run();
819 } 827 }
820 828
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698