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

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

Issue 2569333003: Rename BookmarkIndex to TitledUrlIndex and BookmarkMatch to TitledUrlMatch (Closed)
Patch Set: fix bookmark_bridge.cc Created 4 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "chrome/browser/importer/profile_writer.h" 5 #include "chrome/browser/importer/profile_writer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/macros.h" 11 #include "base/macros.h"
12 #include "base/run_loop.h" 12 #include "base/run_loop.h"
13 #include "base/strings/utf_string_conversions.h" 13 #include "base/strings/utf_string_conversions.h"
14 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 14 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
15 #include "chrome/browser/history/history_service_factory.h" 15 #include "chrome/browser/history/history_service_factory.h"
16 #include "chrome/browser/importer/importer_unittest_utils.h" 16 #include "chrome/browser/importer/importer_unittest_utils.h"
17 #include "chrome/common/importer/imported_bookmark_entry.h" 17 #include "chrome/common/importer/imported_bookmark_entry.h"
18 #include "chrome/test/base/testing_profile.h" 18 #include "chrome/test/base/testing_profile.h"
19 #include "components/bookmarks/browser/bookmark_match.h"
20 #include "components/bookmarks/browser/bookmark_model.h" 19 #include "components/bookmarks/browser/bookmark_model.h"
21 #include "components/bookmarks/browser/bookmark_utils.h" 20 #include "components/bookmarks/browser/bookmark_utils.h"
21 #include "components/bookmarks/browser/titled_url_match.h"
22 #include "components/bookmarks/test/bookmark_test_helpers.h" 22 #include "components/bookmarks/test/bookmark_test_helpers.h"
23 #include "components/history/core/browser/history_service.h" 23 #include "components/history/core/browser/history_service.h"
24 #include "components/history/core/browser/history_types.h" 24 #include "components/history/core/browser/history_types.h"
25 #include "content/public/test/test_browser_thread_bundle.h" 25 #include "content/public/test/test_browser_thread_bundle.h"
26 #include "testing/gtest/include/gtest/gtest.h" 26 #include "testing/gtest/include/gtest/gtest.h"
27 27
28 using bookmarks::BookmarkMatch;
29 using bookmarks::BookmarkModel; 28 using bookmarks::BookmarkModel;
29 using bookmarks::TitledUrlMatch;
30 30
31 class TestProfileWriter : public ProfileWriter { 31 class TestProfileWriter : public ProfileWriter {
32 public: 32 public:
33 explicit TestProfileWriter(Profile* profile) : ProfileWriter(profile) {} 33 explicit TestProfileWriter(Profile* profile) : ProfileWriter(profile) {}
34 protected: 34 protected:
35 ~TestProfileWriter() override {} 35 ~TestProfileWriter() override {}
36 }; 36 };
37 37
38 class ProfileWriterTest : public testing::Test { 38 class ProfileWriterTest : public testing::Test {
39 public: 39 public:
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after
74 MakeURLRow("http://www.yahoo.com", base::ASCIIToUTF16("Yahoo"), 74 MakeURLRow("http://www.yahoo.com", base::ASCIIToUTF16("Yahoo"),
75 3, 30, 10)); 75 3, 30, 10));
76 pages_.push_back(row1); 76 pages_.push_back(row1);
77 pages_.push_back(row2); 77 pages_.push_back(row2);
78 } 78 }
79 79
80 void VerifyBookmarksCount( 80 void VerifyBookmarksCount(
81 const std::vector<BookmarkModel::URLAndTitle>& bookmarks_record, 81 const std::vector<BookmarkModel::URLAndTitle>& bookmarks_record,
82 BookmarkModel* bookmark_model, 82 BookmarkModel* bookmark_model,
83 size_t expected) { 83 size_t expected) {
84 std::vector<BookmarkMatch> matches; 84 std::vector<TitledUrlMatch> matches;
85 for (size_t i = 0; i < bookmarks_record.size(); ++i) { 85 for (size_t i = 0; i < bookmarks_record.size(); ++i) {
86 bookmark_model->GetBookmarksMatching( 86 bookmark_model->GetBookmarksMatching(
87 bookmarks_record[i].title, 10, &matches); 87 bookmarks_record[i].title, 10, &matches);
88 EXPECT_EQ(expected, matches.size()); 88 EXPECT_EQ(expected, matches.size());
89 matches.clear(); 89 matches.clear();
90 } 90 }
91 } 91 }
92 92
93 void VerifyHistoryCount(Profile* profile) { 93 void VerifyHistoryCount(Profile* profile) {
94 history::HistoryService* history_service = 94 history::HistoryService* history_service =
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 new TestProfileWriter(&profile)); 201 new TestProfileWriter(&profile));
202 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); 202 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED);
203 VerifyHistoryCount(&profile); 203 VerifyHistoryCount(&profile);
204 size_t original_history_count = history_count_; 204 size_t original_history_count = history_count_;
205 history_count_ = 0; 205 history_count_ = 0;
206 206
207 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED); 207 profile_writer->AddHistoryPage(pages_, history::SOURCE_FIREFOX_IMPORTED);
208 VerifyHistoryCount(&profile); 208 VerifyHistoryCount(&profile);
209 EXPECT_EQ(original_history_count, history_count_); 209 EXPECT_EQ(original_history_count, history_count_);
210 } 210 }
OLDNEW
« no previous file with comments | « chrome/browser/android/bookmarks/bookmark_bridge.cc ('k') | components/bookmarks/browser/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698