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

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: Minor changes. Created 6 years 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 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}"}, 91 "http://en.wikipedia.org/wiki/Special:Search?search={searchTerms}"},
92 {L"search.yahoo.com", L"search.yahoo.com", 92 {L"search.yahoo.com", L"search.yahoo.com",
93 "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8"}, 93 "http://search.yahoo.com/search?p={searchTerms}&ei=UTF-8"},
94 {L"flickr.com", L"flickr.com", 94 {L"flickr.com", L"flickr.com",
95 "http://www.flickr.com/photos/tags/?q={searchTerms}"}, 95 "http://www.flickr.com/photos/tags/?q={searchTerms}"},
96 {L"imdb.com", L"imdb.com", "http://www.imdb.com/find?q={searchTerms}"}, 96 {L"imdb.com", L"imdb.com", "http://www.imdb.com/find?q={searchTerms}"},
97 {L"webster.com", L"webster.com", 97 {L"webster.com", L"webster.com",
98 "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}"}, 98 "http://www.webster.com/cgi-bin/dictionary?va={searchTerms}"},
99 // Search keywords. 99 // Search keywords.
100 {L"\x4E2D\x6587", L"\x4E2D\x6587", "http://www.google.com/"}, 100 {L"\x4E2D\x6587", L"\x4E2D\x6587", "http://www.google.com/"},
101 {L"keyword", L"keyword", "http://example.{searchTerms}.com/"},
102 // in_process_importer_bridge.cc:CreateTemplateURL() will return NULL for
103 // the following bookmark. Consequently, it won't be imported as a search
104 // engine.
105 {L"", L"", "http://%x.example.{searchTerms}.com/"},
101 }; 106 };
102 107
103 const AutofillFormDataInfo kFirefoxAutofillEntries[] = { 108 const AutofillFormDataInfo kFirefoxAutofillEntries[] = {
104 {"name", "John"}, 109 {"name", "John"},
105 {"address", "#123 Cherry Ave"}, 110 {"address", "#123 Cherry Ave"},
106 {"city", "Mountain View"}, 111 {"city", "Mountain View"},
107 {"zip", "94043"}, 112 {"zip", "94043"},
108 {"n300", "+1 (408) 871-4567"}, 113 {"n300", "+1 (408) 871-4567"},
109 {"name", "john"}, 114 {"name", "john"},
110 {"name", "aguantó"}, 115 {"name", "aguantó"},
(...skipping 17 matching lines...) Expand all
128 133
129 // importer::ImporterProgressObserver: 134 // importer::ImporterProgressObserver:
130 void ImportStarted() override {} 135 void ImportStarted() override {}
131 void ImportItemStarted(importer::ImportItem item) override {} 136 void ImportItemStarted(importer::ImportItem item) override {}
132 void ImportItemEnded(importer::ImportItem item) override {} 137 void ImportItemEnded(importer::ImportItem item) override {}
133 void ImportEnded() override { 138 void ImportEnded() override {
134 base::MessageLoop::current()->Quit(); 139 base::MessageLoop::current()->Quit();
135 EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_); 140 EXPECT_EQ(arraysize(kFirefoxBookmarks), bookmark_count_);
136 EXPECT_EQ(1U, history_count_); 141 EXPECT_EQ(1U, history_count_);
137 EXPECT_EQ(arraysize(kFirefoxPasswords), password_count_); 142 EXPECT_EQ(arraysize(kFirefoxPasswords), password_count_);
138 EXPECT_EQ(arraysize(kFirefoxKeywords), keyword_count_); 143 // The following test case from |kFirefoxKeywords| won't be imported:
144 // "http://%x.example.{searchTerms}.com/"}.
145 // Hence, value of |keyword_count_| should be lower than size of
146 // |kFirefoxKeywords| by 1.
147 EXPECT_EQ(arraysize(kFirefoxKeywords) - 1, keyword_count_);
139 } 148 }
140 149
141 bool BookmarkModelIsLoaded() const override { 150 bool BookmarkModelIsLoaded() const override {
142 // Profile is ready for writing. 151 // Profile is ready for writing.
143 return true; 152 return true;
144 } 153 }
145 154
146 bool TemplateURLServiceIsLoaded() const override { return true; } 155 bool TemplateURLServiceIsLoaded() const override { return true; }
147 156
148 void AddPasswordForm(const autofill::PasswordForm& form) override { 157 void AddPasswordForm(const autofill::PasswordForm& form) override {
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after
326 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(false)); 335 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(false));
327 FirefoxImporterBrowserTest( 336 FirefoxImporterBrowserTest(
328 "firefox35_profile", observer.get(), observer.get()); 337 "firefox35_profile", observer.get(), observer.get());
329 } 338 }
330 339
331 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest, 340 IN_PROC_BROWSER_TEST_F(FirefoxProfileImporterBrowserTest,
332 MAYBE_IMPORTER(FirefoxImporter)) { 341 MAYBE_IMPORTER(FirefoxImporter)) {
333 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(true)); 342 scoped_refptr<FirefoxObserver> observer(new FirefoxObserver(true));
334 FirefoxImporterBrowserTest("firefox_profile", observer.get(), observer.get()); 343 FirefoxImporterBrowserTest("firefox_profile", observer.get(), observer.get());
335 } 344 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698