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

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

Issue 616763002: Importing certain bookmarks from firefox and HTML file as search engines. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Addressed dependency issue. Created 5 years, 11 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
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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/files/file_util.h" 6 #include "base/files/file_util.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 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}"}, 99 "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}"},
100 {L"search.yahoo.com", L"search.yahoo.com", 100 {L"search.yahoo.com", L"search.yahoo.com",
101 "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8"}, 101 "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8"},
102 {L"flickr.com", L"flickr.com", 102 {L"flickr.com", L"flickr.com",
103 "http://www.flickr.com/photos/tags/?q={searchTerms}"}, 103 "http://www.flickr.com/photos/tags/?q={searchTerms}"},
104 {L"imdb.com", L"imdb.com", "http://www.imdb.com/find?q={searchTerms}"}, 104 {L"imdb.com", L"imdb.com", "http://www.imdb.com/find?q={searchTerms}"},
105 {L"webster.com", L"webster.com", 105 {L"webster.com", L"webster.com",
106 "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}"}, 106 "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}"},
107 // Search keywords. 107 // Search keywords.
108 {L"\x4E2D\x6587", L"\x4E2D\x6587", "http://www.google.com/"}, 108 {L"\x4E2D\x6587", L"\x4E2D\x6587", "http://www.google.com/"},
109 {L"keyword", L"keyword", "http://example.{searchTerms}.com/"},
110 // in_process_importer_bridge.cc:CreateTemplateURL() will return NULL for
111 // the following bookmark. Consequently, it won't be imported as a search
112 // engine.
113 {L"", L"", "http://%x.example.{searchTerms}.com/"},
109 }; 114 };
110 115
111 const AutofillFormDataInfo kFirefoxAutofillEntries[] = { 116 const AutofillFormDataInfo kFirefoxAutofillEntries[] = {
112 {"name", "John"}, 117 {"name", "John"},
113 {"address", "#123 Cherry Ave"}, 118 {"address", "#123 Cherry Ave"},
114 {"city", "Mountain View"}, 119 {"city", "Mountain View"},
115 {"zip", "94043"}, 120 {"zip", "94043"},
116 {"n300", "+1 (408) 871-4567"}, 121 {"n300", "+1 (408) 871-4567"},
117 {"name", "john"}, 122 {"name", "john"},
118 {"name", "aguantó"}, 123 {"name", "aguantó"},
(...skipping 17 matching lines...) Expand all
136 141
137 // importer::ImporterProgressObserver: 142 // importer::ImporterProgressObserver:
138 void ImportStarted() override {} 143 void ImportStarted() override {}
139 void ImportItemStarted(importer::ImportItem item) override {} 144 void ImportItemStarted(importer::ImportItem item) override {}
140 void ImportItemEnded(importer::ImportItem item) override {} 145 void ImportItemEnded(importer::ImportItem item) override {}
141 void ImportEnded() override { 146 void ImportEnded() override {
142 base::MessageLoop::current()->Quit(); 147 base::MessageLoop::current()->Quit();
143 EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_); 148 EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_);
144 EXPECT_EQ(1U, history_count_); 149 EXPECT_EQ(1U, history_count_);
145 EXPECT_EQ(arraysize(kFirefoxPasswords), password_count_); 150 EXPECT_EQ(arraysize(kFirefoxPasswords), password_count_);
146 EXPECT_EQ(arraysize(kFirefoxKeywords), keyword_count_); 151 // The following test case from |kFirefoxKeywords| won't be imported:
152 // "http://%x.example.{searchTerms}.com/"}.
153 // Hence, value of |keyword_count_| should be lower than size of
154 // |kFirefoxKeywords| by 1.
155 EXPECT_EQ(arraysize(kFirefoxKeywords) - 1, keyword_count_);
147 } 156 }
148 157
149 bool BookmarkModelIsLoaded() const override { 158 bool BookmarkModelIsLoaded() const override {
150 // Profile is ready for writing. 159 // Profile is ready for writing.
151 return true; 160 return true;
152 } 161 }
153 162
154 bool TemplateURLServiceIsLoaded() const override { return true; } 163 bool TemplateURLServiceIsLoaded() const override { return true; }
155 164
156 void AddPasswordForm(const autofill::PasswordForm& form) override { 165 void AddPasswordForm(const autofill::PasswordForm& form) override {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
334 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(false)); 343 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(false));
335 FirefoxImporterBrowserTest( 344 FirefoxImporterBrowserTest(
336 "firefox35_profile", observer.get(), observer.get()); 345 "firefox35_profile", observer.get(), observer.get());
337 } 346 }
338 347
339 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, 348 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest,
340 MAYBE_IMPORTER(FirefoxImporter)) { 349 MAYBE_IMPORTER(FirefoxImporter)) {
341 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(true)); 350 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(true));
342 FirefoxImporterBrowserTest("firefox_profile", observer.get(), observer.get()); 351 FirefoxImporterBrowserTest("firefox_profile", observer.get(), observer.get());
343 } 352 }
OLDNEW
« no previous file with comments | « chrome/browser/importer/external_process_importer_client.cc ('k') | chrome/browser/importer/in_process_importer_bridge.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698