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

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

Issue 9471: Adds import/export of bookmarks to bookmarks.html file.... (Closed) Base URL: svn://chrome-svn/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 | « chrome/browser/importer/importer.cc ('k') | chrome/browser/importer/toolbar_importer.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 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 } 182 }
183 183
184 virtual void AddHistoryPage(const std::vector<history::URLRow>& page) { 184 virtual void AddHistoryPage(const std::vector<history::URLRow>& page) {
185 // Importer should read the specified URL. 185 // Importer should read the specified URL.
186 for (size_t i = 0; i < page.size(); ++i) 186 for (size_t i = 0; i < page.size(); ++i)
187 if (page[i].title() == kIEIdentifyTitle && 187 if (page[i].title() == kIEIdentifyTitle &&
188 page[i].url() == GURL(kIEIdentifyUrl)) 188 page[i].url() == GURL(kIEIdentifyUrl))
189 ++history_count_; 189 ++history_count_;
190 } 190 }
191 191
192 virtual void AddBookmarkEntry( 192 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark,
193 const std::vector<BookmarkEntry>& bookmark, 193 const std::wstring& first_folder_name,
194 bool check_duplicates) { 194 int options) {
195 // Importer should import the IE Favorites folder the same as the list. 195 // Importer should import the IE Favorites folder the same as the list.
196 for (size_t i = 0; i < bookmark.size(); ++i) { 196 for (size_t i = 0; i < bookmark.size(); ++i) {
197 if (FindBookmarkEntry(bookmark[i], kIEBookmarks, 197 if (FindBookmarkEntry(bookmark[i], kIEBookmarks,
198 arraysize(kIEBookmarks))) 198 arraysize(kIEBookmarks)))
199 ++bookmark_count_; 199 ++bookmark_count_;
200 } 200 }
201 } 201 }
202 202
203 virtual void AddKeyword(std::vector<TemplateURL*> template_url, 203 virtual void AddKeyword(std::vector<TemplateURL*> template_url,
204 int default_keyword_index) { 204 int default_keyword_index) {
(...skipping 333 matching lines...) Expand 10 before | Expand all | Expand 10 after
538 } 538 }
539 539
540 virtual void AddHistoryPage(const std::vector<history::URLRow>& page) { 540 virtual void AddHistoryPage(const std::vector<history::URLRow>& page) {
541 EXPECT_EQ(1, page.size()); 541 EXPECT_EQ(1, page.size());
542 EXPECT_EQ("http://en-us.www.mozilla.com/", page[0].url().spec()); 542 EXPECT_EQ("http://en-us.www.mozilla.com/", page[0].url().spec());
543 EXPECT_EQ(L"Firefox Updated", page[0].title()); 543 EXPECT_EQ(L"Firefox Updated", page[0].title());
544 ++history_count_; 544 ++history_count_;
545 } 545 }
546 546
547 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark, 547 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark,
548 bool check_duplicates) { 548 const std::wstring& first_folder_name,
549 int options) {
549 for (size_t i = 0; i < bookmark.size(); ++i) { 550 for (size_t i = 0; i < bookmark.size(); ++i) {
550 if (FindBookmarkEntry(bookmark[i], kFirefox2Bookmarks, 551 if (FindBookmarkEntry(bookmark[i], kFirefox2Bookmarks,
551 arraysize(kFirefox2Bookmarks))) 552 arraysize(kFirefox2Bookmarks)))
552 ++bookmark_count_; 553 ++bookmark_count_;
553 } 554 }
554 } 555 }
555 556
556 virtual void AddKeywords(const std::vector<TemplateURL*>& template_urls, 557 virtual void AddKeywords(const std::vector<TemplateURL*>& template_urls,
557 int default_keyword_index, 558 int default_keyword_index,
558 bool unique_on_host_and_path) { 559 bool unique_on_host_and_path) {
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
738 EXPECT_EQ(L"Google", page[0].title()); 739 EXPECT_EQ(L"Google", page[0].title());
739 EXPECT_EQ("http://www.google.com/", page[1].url().spec()); 740 EXPECT_EQ("http://www.google.com/", page[1].url().spec());
740 EXPECT_EQ(L"Google", page[1].title()); 741 EXPECT_EQ(L"Google", page[1].title());
741 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/form1 -POST.html", 742 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/form1 -POST.html",
742 page[2].url().spec()); 743 page[2].url().spec());
743 EXPECT_EQ(L"example form (POST)", page[2].title()); 744 EXPECT_EQ(L"example form (POST)", page[2].title());
744 ++history_count_; 745 ++history_count_;
745 } 746 }
746 747
747 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark, 748 virtual void AddBookmarkEntry(const std::vector<BookmarkEntry>& bookmark,
748 bool check_duplicates) { 749 const std::wstring& first_folder_name,
750 int options) {
749 for (size_t i = 0; i < bookmark.size(); ++i) { 751 for (size_t i = 0; i < bookmark.size(); ++i) {
750 if (FindBookmarkEntry(bookmark[i], kFirefox3Bookmarks, 752 if (FindBookmarkEntry(bookmark[i], kFirefox3Bookmarks,
751 arraysize(kFirefox3Bookmarks))) 753 arraysize(kFirefox3Bookmarks)))
752 ++bookmark_count_; 754 ++bookmark_count_;
753 } 755 }
754 } 756 }
755 757
756 void AddKeywords(const std::vector<TemplateURL*>& template_urls, 758 void AddKeywords(const std::vector<TemplateURL*>& template_urls,
757 int default_keyword_index, 759 int default_keyword_index,
758 bool unique_on_host_and_path) { 760 bool unique_on_host_and_path) {
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after
822 profile_info.app_path = app_path_; 824 profile_info.app_path = app_path_;
823 profile_info.source_path = profile_path_; 825 profile_info.source_path = profile_path_;
824 scoped_refptr<ImporterHost> host = new ImporterHost(loop); 826 scoped_refptr<ImporterHost> host = new ImporterHost(loop);
825 Firefox3Observer* observer = new Firefox3Observer(); 827 Firefox3Observer* observer = new Firefox3Observer();
826 host->SetObserver(observer); 828 host->SetObserver(observer);
827 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(), 829 loop->PostTask(FROM_HERE, NewRunnableMethod(host.get(),
828 &ImporterHost::StartImportSettings, profile_info, 830 &ImporterHost::StartImportSettings, profile_info,
829 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true)); 831 HISTORY | PASSWORDS | FAVORITES | SEARCH_ENGINES, observer, true));
830 loop->Run(); 832 loop->Run();
831 } 833 }
832
OLDNEW
« no previous file with comments | « chrome/browser/importer/importer.cc ('k') | chrome/browser/importer/toolbar_importer.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698