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

Side by Side Diff: chrome/browser/history/history_backend_unittest.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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 <algorithm> 5 #include <algorithm>
6 #include <set> 6 #include <set>
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/bind.h" 10 #include "base/bind.h"
11 #include "base/bind_helpers.h" 11 #include "base/bind_helpers.h"
12 #include "base/command_line.h" 12 #include "base/command_line.h"
13 #include "base/file_util.h" 13 #include "base/file_util.h"
14 #include "base/files/file_path.h" 14 #include "base/files/file_path.h"
15 #include "base/memory/ref_counted.h" 15 #include "base/memory/ref_counted.h"
16 #include "base/memory/scoped_ptr.h" 16 #include "base/memory/scoped_ptr.h"
17 #include "base/path_service.h" 17 #include "base/path_service.h"
18 #include "base/string16.h" 18 #include "base/string16.h"
19 #include "base/strings/string_number_conversions.h" 19 #include "base/strings/string_number_conversions.h"
20 #include "base/utf_string_conversions.h" 20 #include "base/utf_string_conversions.h"
21 #include "chrome/browser/bookmarks/bookmark_model.h" 21 #include "chrome/browser/bookmarks/bookmark_model.h"
22 #include "chrome/browser/bookmarks/bookmark_utils.h" 22 #include "chrome/browser/bookmarks/bookmark_utils.h"
23 #include "chrome/browser/favicon/imported_favicon_usage.h"
23 #include "chrome/browser/history/history_backend.h" 24 #include "chrome/browser/history/history_backend.h"
24 #include "chrome/browser/history/history_notifications.h" 25 #include "chrome/browser/history/history_notifications.h"
25 #include "chrome/browser/history/in_memory_database.h" 26 #include "chrome/browser/history/in_memory_database.h"
26 #include "chrome/browser/history/in_memory_history_backend.h" 27 #include "chrome/browser/history/in_memory_history_backend.h"
27 #include "chrome/browser/history/visit_filter.h" 28 #include "chrome/browser/history/visit_filter.h"
28 #include "chrome/common/chrome_constants.h" 29 #include "chrome/common/chrome_constants.h"
29 #include "chrome/common/chrome_paths.h" 30 #include "chrome/common/chrome_paths.h"
30 #include "chrome/common/chrome_switches.h" 31 #include "chrome/common/chrome_switches.h"
31 #include "chrome/common/thumbnail_score.h" 32 #include "chrome/common/thumbnail_score.h"
32 #include "chrome/tools/profiles/thumbnail-inl.h" 33 #include "chrome/tools/profiles/thumbnail-inl.h"
(...skipping 845 matching lines...) Expand 10 before | Expand all | Expand 10 after
878 backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED); 879 backend_->AddPagesWithDetails(rows, history::SOURCE_BROWSED);
879 URLRow url_row1, url_row2; 880 URLRow url_row1, url_row2;
880 EXPECT_FALSE(backend_->db_->GetRowForURL(row1.url(), &url_row1) == 0); 881 EXPECT_FALSE(backend_->db_->GetRowForURL(row1.url(), &url_row1) == 0);
881 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &url_row2) == 0); 882 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &url_row2) == 0);
882 EXPECT_EQ(1u, NumIconMappingsForPageURL(row1.url(), FAVICON)); 883 EXPECT_EQ(1u, NumIconMappingsForPageURL(row1.url(), FAVICON));
883 EXPECT_EQ(0u, NumIconMappingsForPageURL(row2.url(), FAVICON)); 884 EXPECT_EQ(0u, NumIconMappingsForPageURL(row2.url(), FAVICON));
884 885
885 // Now provide one imported favicon for both URLs already in the registry. 886 // Now provide one imported favicon for both URLs already in the registry.
886 // The new favicon should only be used with the URL that doesn't already have 887 // The new favicon should only be used with the URL that doesn't already have
887 // a favicon. 888 // a favicon.
888 std::vector<history::ImportedFaviconUsage> favicons; 889 std::vector<ImportedFaviconUsage> favicons;
889 history::ImportedFaviconUsage favicon; 890 ImportedFaviconUsage favicon;
890 favicon.favicon_url = GURL("http://news.google.com/favicon.ico"); 891 favicon.favicon_url = GURL("http://news.google.com/favicon.ico");
891 favicon.png_data.push_back('2'); 892 favicon.png_data.push_back('2');
892 favicon.urls.insert(row1.url()); 893 favicon.urls.insert(row1.url());
893 favicon.urls.insert(row2.url()); 894 favicon.urls.insert(row2.url());
894 favicons.push_back(favicon); 895 favicons.push_back(favicon);
895 backend_->SetImportedFavicons(favicons); 896 backend_->SetImportedFavicons(favicons);
896 EXPECT_FALSE(backend_->db_->GetRowForURL(row1.url(), &url_row1) == 0); 897 EXPECT_FALSE(backend_->db_->GetRowForURL(row1.url(), &url_row1) == 0);
897 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &url_row2) == 0); 898 EXPECT_FALSE(backend_->db_->GetRowForURL(row2.url(), &url_row2) == 0);
898 899
899 std::vector<IconMapping> mappings; 900 std::vector<IconMapping> mappings;
(...skipping 1843 matching lines...) Expand 10 before | Expand all | Expand 10 after
2743 EXPECT_EQ(url2.spec(), data[0]->GetURL().spec()); 2744 EXPECT_EQ(url2.spec(), data[0]->GetURL().spec());
2744 EXPECT_EQ(url2_id, data[0]->GetID()); 2745 EXPECT_EQ(url2_id, data[0]->GetID());
2745 EXPECT_EQ(segment2_time_delta.InHours(), data[0]->duration().InHours()); 2746 EXPECT_EQ(segment2_time_delta.InHours(), data[0]->duration().InHours());
2746 2747
2747 EXPECT_EQ(url1.spec(), data[1]->GetURL().spec()); 2748 EXPECT_EQ(url1.spec(), data[1]->GetURL().spec());
2748 EXPECT_EQ(url1_id, data[1]->GetID()); 2749 EXPECT_EQ(url1_id, data[1]->GetID());
2749 EXPECT_EQ(segment1_time_delta.InHours(), data[1]->duration().InHours()); 2750 EXPECT_EQ(segment1_time_delta.InHours(), data[1]->duration().InHours());
2750 } 2751 }
2751 2752
2752 } // namespace history 2753 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698