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

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

Issue 14575004: Extract BookmarksFileImporter from Firefox2Importer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: test cleanup Created 7 years, 7 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 | Annotate | Revision Log
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 // The order of these includes is important. 5 // The order of these includes is important.
6 #include <windows.h> 6 #include <windows.h>
7 #include <unknwn.h> 7 #include <unknwn.h>
8 #include <intshcut.h> 8 #include <intshcut.h>
9 #include <shlguid.h> 9 #include <shlguid.h>
10 #include <urlhist.h> 10 #include <urlhist.h>
(...skipping 10 matching lines...) Expand all
21 #include "base/message_loop.h" 21 #include "base/message_loop.h"
22 #include "base/path_service.h" 22 #include "base/path_service.h"
23 #include "base/stl_util.h" 23 #include "base/stl_util.h"
24 #include "base/string16.h" 24 #include "base/string16.h"
25 #include "base/string_util.h" 25 #include "base/string_util.h"
26 #include "base/utf_string_conversions.h" 26 #include "base/utf_string_conversions.h"
27 #include "base/win/registry.h" 27 #include "base/win/registry.h"
28 #include "base/win/scoped_comptr.h" 28 #include "base/win/scoped_comptr.h"
29 #include "base/win/scoped_propvariant.h" 29 #include "base/win/scoped_propvariant.h"
30 #include "base/win/windows_version.h" 30 #include "base/win/windows_version.h"
31 #include "chrome/browser/history/history_types.h" 31 #include "chrome/browser/bookmarks/imported_bookmark_entry.h"
32 #include "chrome/browser/favicon/imported_favicon_usage.h"
32 #include "chrome/browser/importer/ie_importer.h" 33 #include "chrome/browser/importer/ie_importer.h"
33 #include "chrome/browser/importer/ie_importer_test_registry_overrider_win.h" 34 #include "chrome/browser/importer/ie_importer_test_registry_overrider_win.h"
34 #include "chrome/browser/importer/importer_bridge.h" 35 #include "chrome/browser/importer/importer_bridge.h"
35 #include "chrome/browser/importer/importer_data_types.h" 36 #include "chrome/browser/importer/importer_data_types.h"
36 #include "chrome/browser/importer/importer_host.h" 37 #include "chrome/browser/importer/importer_host.h"
37 #include "chrome/browser/importer/importer_progress_observer.h" 38 #include "chrome/browser/importer/importer_progress_observer.h"
38 #include "chrome/browser/importer/importer_unittest_utils.h" 39 #include "chrome/browser/importer/importer_unittest_utils.h"
39 #include "chrome/browser/importer/pstore_declarations.h" 40 #include "chrome/browser/importer/pstore_declarations.h"
40 #include "chrome/browser/search_engines/template_url.h" 41 #include "chrome/browser/search_engines/template_url.h"
41 #include "chrome/browser/ui/browser.h" 42 #include "chrome/browser/ui/browser.h"
(...skipping 258 matching lines...) Expand 10 before | Expand all | Expand 10 after
300 history::VisitSource visit_source) { 301 history::VisitSource visit_source) {
301 // Importer should read the specified URL. 302 // Importer should read the specified URL.
302 for (size_t i = 0; i < page.size(); ++i) { 303 for (size_t i = 0; i < page.size(); ++i) {
303 if (page[i].title() == kIEIdentifyTitle && 304 if (page[i].title() == kIEIdentifyTitle &&
304 page[i].url() == GURL(kIEIdentifyUrl)) 305 page[i].url() == GURL(kIEIdentifyUrl))
305 ++history_count_; 306 ++history_count_;
306 } 307 }
307 EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source); 308 EXPECT_EQ(history::SOURCE_IE_IMPORTED, visit_source);
308 } 309 }
309 310
310 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, 311 virtual void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks,
311 const string16& top_level_folder_name) OVERRIDE { 312 const string16& top_level_folder_name) OVERRIDE {
312 ASSERT_LE(bookmark_count_ + bookmarks.size(), arraysize(kIEBookmarks)); 313 ASSERT_LE(bookmark_count_ + bookmarks.size(), arraysize(kIEBookmarks));
313 // Importer should import the IE Favorites folder the same as the list, 314 // Importer should import the IE Favorites folder the same as the list,
314 // in the same order. 315 // in the same order.
315 for (size_t i = 0; i < bookmarks.size(); ++i) { 316 for (size_t i = 0; i < bookmarks.size(); ++i) {
316 EXPECT_NO_FATAL_FAILURE( 317 EXPECT_NO_FATAL_FAILURE(
317 TestEqualBookmarkEntry(bookmarks[i], 318 TestEqualBookmarkEntry(bookmarks[i],
318 kIEBookmarks[bookmark_count_])) << i; 319 kIEBookmarks[bookmark_count_])) << i;
319 ++bookmark_count_; 320 ++bookmark_count_;
320 } 321 }
321 } 322 }
322 323
323 virtual void AddKeyword(std::vector<TemplateURL*> template_url, 324 virtual void AddKeyword(std::vector<TemplateURL*> template_url,
324 int default_keyword_index) { 325 int default_keyword_index) {
325 // TODO(jcampan): bug 1169230: we should test keyword importing for IE. 326 // TODO(jcampan): bug 1169230: we should test keyword importing for IE.
326 // In order to do that we'll probably need to mock the Windows registry. 327 // In order to do that we'll probably need to mock the Windows registry.
327 NOTREACHED(); 328 NOTREACHED();
328 STLDeleteContainerPointers(template_url.begin(), template_url.end()); 329 STLDeleteContainerPointers(template_url.begin(), template_url.end());
329 } 330 }
330 331
331 virtual void AddFavicons( 332 virtual void AddFavicons(
332 const std::vector<history::ImportedFaviconUsage>& usage) OVERRIDE { 333 const std::vector<ImportedFaviconUsage>& usage) OVERRIDE {
333 // Importer should group the favicon information for each favicon URL. 334 // Importer should group the favicon information for each favicon URL.
334 for (size_t i = 0; i < arraysize(kIEFaviconGroup); ++i) { 335 for (size_t i = 0; i < arraysize(kIEFaviconGroup); ++i) {
335 GURL favicon_url(kIEFaviconGroup[i].favicon_url); 336 GURL favicon_url(kIEFaviconGroup[i].favicon_url);
336 std::set<GURL> urls; 337 std::set<GURL> urls;
337 for (size_t j = 0; j < arraysize(kIEFaviconGroup[i].site_url); ++j) 338 for (size_t j = 0; j < arraysize(kIEFaviconGroup[i].site_url); ++j)
338 urls.insert(GURL(kIEFaviconGroup[i].site_url[j])); 339 urls.insert(GURL(kIEFaviconGroup[i].site_url[j]));
339 340
340 SCOPED_TRACE(testing::Message() << "Expected Favicon: " << favicon_url); 341 SCOPED_TRACE(testing::Message() << "Expected Favicon: " << favicon_url);
341 342
342 bool expected_favicon_url_found = false; 343 bool expected_favicon_url_found = false;
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after
380 } 381 }
381 382
382 virtual bool BookmarkModelIsLoaded() const { return true; } 383 virtual bool BookmarkModelIsLoaded() const { return true; }
383 virtual bool TemplateURLServiceIsLoaded() const { return true; } 384 virtual bool TemplateURLServiceIsLoaded() const { return true; }
384 385
385 virtual void AddPasswordForm(const content::PasswordForm& form) {} 386 virtual void AddPasswordForm(const content::PasswordForm& form) {}
386 virtual void AddHistoryPage(const history::URLRows& page, 387 virtual void AddHistoryPage(const history::URLRows& page,
387 history::VisitSource visit_source) {} 388 history::VisitSource visit_source) {}
388 virtual void AddKeyword(std::vector<TemplateURL*> template_url, 389 virtual void AddKeyword(std::vector<TemplateURL*> template_url,
389 int default_keyword_index) {} 390 int default_keyword_index) {}
390 virtual void AddBookmarks(const std::vector<BookmarkEntry>& bookmarks, 391 virtual void AddBookmarks(const std::vector<ImportedBookmarkEntry>& bookmarks,
391 const string16& top_level_folder_name) OVERRIDE { 392 const string16& top_level_folder_name) OVERRIDE {
392 ASSERT_LE(bookmark_count_ + bookmarks.size(), 393 ASSERT_LE(bookmark_count_ + bookmarks.size(),
393 arraysize(kIESortedBookmarks)); 394 arraysize(kIESortedBookmarks));
394 for (size_t i = 0; i < bookmarks.size(); ++i) { 395 for (size_t i = 0; i < bookmarks.size(); ++i) {
395 EXPECT_NO_FATAL_FAILURE( 396 EXPECT_NO_FATAL_FAILURE(
396 TestEqualBookmarkEntry(bookmarks[i], 397 TestEqualBookmarkEntry(bookmarks[i],
397 kIESortedBookmarks[bookmark_count_])) << i; 398 kIESortedBookmarks[bookmark_count_])) << i;
398 ++bookmark_count_; 399 ++bookmark_count_;
399 } 400 }
400 } 401 }
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 source_profile.source_path = temp_dir_.path(); 576 source_profile.source_path = temp_dir_.path();
576 577
577 host->StartImportSettings( 578 host->StartImportSettings(
578 source_profile, 579 source_profile,
579 browser()->profile(), 580 browser()->profile(),
580 importer::FAVORITES, 581 importer::FAVORITES,
581 observer); 582 observer);
582 MessageLoop::current()->Run(); 583 MessageLoop::current()->Run();
583 } 584 }
584 } 585 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698