| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "build/build_config.h" | 5 #include "build/build_config.h" |
| 6 | 6 |
| 7 #if defined(OS_WIN) | 7 #if defined(OS_WIN) |
| 8 // The order of these includes is important. | 8 // The order of these includes is important. |
| 9 #include <windows.h> | 9 #include <windows.h> |
| 10 #include <unknwn.h> | 10 #include <unknwn.h> |
| (...skipping 220 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 231 history::VisitSource visit_source) { | 231 history::VisitSource visit_source) { |
| 232 // Importer should read the specified URL. | 232 // Importer should read the specified URL. |
| 233 for (size_t i = 0; i < page.size(); ++i) { | 233 for (size_t i = 0; i < page.size(); ++i) { |
| 234 if (page[i].title() == kIEIdentifyTitle && | 234 if (page[i].title() == kIEIdentifyTitle && |
| 235 page[i].url() == GURL(kIEIdentifyUrl)) | 235 page[i].url() == GURL(kIEIdentifyUrl)) |
| 236 ++history_count_; | 236 ++history_count_; |
| 237 } | 237 } |
| 238 EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source); | 238 EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source); |
| 239 } | 239 } |
| 240 | 240 |
| 241 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmark, | 241 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, |
| 242 const string16& first_folder_name, | 242 const string16& top_level_folder_name) OVERRIDE { |
| 243 int options) OVERRIDE { | |
| 244 // Importer should import the IE Favorites folder the same as the list. | 243 // Importer should import the IE Favorites folder the same as the list. |
| 245 for (size_t i = 0; i < bookmark.size(); ++i) { | 244 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 246 if (FindBookmarkEntry(bookmark[i], kIEBookmarks, | 245 if (FindBookmarkEntry(bookmarks[i], kIEBookmarks, |
| 247 arraysize(kIEBookmarks))) | 246 arraysize(kIEBookmarks))) |
| 248 ++bookmark_count_; | 247 ++bookmark_count_; |
| 249 } | 248 } |
| 250 } | 249 } |
| 251 | 250 |
| 252 virtual void AddKeyword(std::vector<TemplateURL*> template_url, | 251 virtual void AddKeyword(std::vector<TemplateURL*> template_url, |
| 253 int default_keyword_index) { | 252 int default_keyword_index) { |
| 254 // TODO(jcampan): bug 1169230: we should test keyword importing for IE. | 253 // TODO(jcampan): bug 1169230: we should test keyword importing for IE. |
| 255 // In order to do that we'll probably need to mock the Windows registry. | 254 // In order to do that we'll probably need to mock the Windows registry. |
| 256 NOTREACHED(); | 255 NOTREACHED(); |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 597 | 596 |
| 598 virtual void AddHistoryPage(const std::vector<history::URLRow>& page, | 597 virtual void AddHistoryPage(const std::vector<history::URLRow>& page, |
| 599 history::VisitSource visit_source) { | 598 history::VisitSource visit_source) { |
| 600 ASSERT_EQ(1U, page.size()); | 599 ASSERT_EQ(1U, page.size()); |
| 601 EXPECT_EQ("http://en-us.www.mozilla.com/", page[0].url().spec()); | 600 EXPECT_EQ("http://en-us.www.mozilla.com/", page[0].url().spec()); |
| 602 EXPECT_EQ(ASCIIToUTF16("Firefox Updated"), page[0].title()); | 601 EXPECT_EQ(ASCIIToUTF16("Firefox Updated"), page[0].title()); |
| 603 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); | 602 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); |
| 604 ++history_count_; | 603 ++history_count_; |
| 605 } | 604 } |
| 606 | 605 |
| 607 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmark, | 606 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, |
| 608 const string16& first_folder_name, | 607 const string16& top_level_folder_name) OVERRIDE { |
| 609 int options) OVERRIDE { | 608 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 610 for (size_t i = 0; i < bookmark.size(); ++i) { | 609 if (FindBookmarkEntry(bookmarks[i], kFirefox2Bookmarks, |
| 611 if (FindBookmarkEntry(bookmark[i], kFirefox2Bookmarks, | |
| 612 arraysize(kFirefox2Bookmarks))) | 610 arraysize(kFirefox2Bookmarks))) |
| 613 ++bookmark_count_; | 611 ++bookmark_count_; |
| 614 } | 612 } |
| 615 } | 613 } |
| 616 | 614 |
| 617 virtual void AddKeywords(const std::vector<TemplateURL*>& template_urls, | 615 virtual void AddKeywords(const std::vector<TemplateURL*>& template_urls, |
| 618 int default_keyword_index, | 616 int default_keyword_index, |
| 619 bool unique_on_host_and_path) { | 617 bool unique_on_host_and_path) { |
| 620 for (size_t i = 0; i < template_urls.size(); ++i) { | 618 for (size_t i = 0; i < template_urls.size(); ++i) { |
| 621 // The order might not be deterministic, look in the expected list for | 619 // The order might not be deterministic, look in the expected list for |
| (...skipping 185 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 807 EXPECT_EQ(ASCIIToUTF16("Google"), page[0].title()); | 805 EXPECT_EQ(ASCIIToUTF16("Google"), page[0].title()); |
| 808 EXPECT_EQ("http://www.google.com/", page[1].url().spec()); | 806 EXPECT_EQ("http://www.google.com/", page[1].url().spec()); |
| 809 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title()); | 807 EXPECT_EQ(ASCIIToUTF16("Google"), page[1].title()); |
| 810 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/form1
-POST.html", | 808 EXPECT_EQ("http://www.cs.unc.edu/~jbs/resources/perl/perl-cgi/programs/form1
-POST.html", |
| 811 page[2].url().spec()); | 809 page[2].url().spec()); |
| 812 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); | 810 EXPECT_EQ(ASCIIToUTF16("example form (POST)"), page[2].title()); |
| 813 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); | 811 EXPECT_EQ(history::SOURCE_FIREFOX_IMPORTED, visit_source); |
| 814 ++history_count_; | 812 ++history_count_; |
| 815 } | 813 } |
| 816 | 814 |
| 817 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmark, | 815 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, |
| 818 const string16& first_folder_name, | 816 const string16& top_level_folder_name) OVERRIDE { |
| 819 int options) OVERRIDE { | 817 for (size_t i = 0; i < bookmarks.size(); ++i) { |
| 820 for (size_t i = 0; i < bookmark.size(); ++i) { | 818 if (FindBookmarkEntry(bookmarks[i], kFirefox3Bookmarks, |
| 821 if (FindBookmarkEntry(bookmark[i], kFirefox3Bookmarks, | |
| 822 arraysize(kFirefox3Bookmarks))) | 819 arraysize(kFirefox3Bookmarks))) |
| 823 ++bookmark_count_; | 820 ++bookmark_count_; |
| 824 } | 821 } |
| 825 } | 822 } |
| 826 | 823 |
| 827 void AddKeywords(const std::vector<TemplateURL*>& template_urls, | 824 void AddKeywords(const std::vector<TemplateURL*>& template_urls, |
| 828 int default_keyword_index, | 825 int default_keyword_index, |
| 829 bool unique_on_host_and_path) { | 826 bool unique_on_host_and_path) { |
| 830 for (size_t i = 0; i < template_urls.size(); ++i) { | 827 for (size_t i = 0; i < template_urls.size(); ++i) { |
| 831 // The order might not be deterministic, look in the expected list for | 828 // The order might not be deterministic, look in the expected list for |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 875 true); | 872 true); |
| 876 } | 873 } |
| 877 | 874 |
| 878 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { | 875 TEST_F(ImporterTest, MAYBE(Firefox35Importer)) { |
| 879 bool import_search_engines = false; | 876 bool import_search_engines = false; |
| 880 scoped_refptr<Firefox3Observer> observer( | 877 scoped_refptr<Firefox3Observer> observer( |
| 881 new Firefox3Observer(import_search_engines)); | 878 new Firefox3Observer(import_search_engines)); |
| 882 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), | 879 Firefox3xImporterTest("firefox35_profile", observer.get(), observer.get(), |
| 883 import_search_engines); | 880 import_search_engines); |
| 884 } | 881 } |
| OLD | NEW |