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

Side by Side Diff: components/bookmarks/browser/bookmark_index_unittest.cc

Issue 2537223008: Add TitledUrlIndex for indexing arbitrary title/URL pairs (Closed)
Patch Set: refactor in-place to preserve history 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 "components/bookmarks/browser/bookmark_index.h" 5 #include "components/bookmarks/browser/bookmark_index.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <string> 9 #include <string>
10 #include <vector> 10 #include <vector>
(...skipping 24 matching lines...) Expand all
35 : typed_count_map_(typed_count_map) {} 35 : typed_count_map_(typed_count_map) {}
36 36
37 bool SupportsTypedCountForNodes() override { return true; } 37 bool SupportsTypedCountForNodes() override { return true; }
38 38
39 void GetTypedCountForNodes( 39 void GetTypedCountForNodes(
40 const NodeSet& nodes, 40 const NodeSet& nodes,
41 NodeTypedCountPairs* node_typed_count_pairs) override { 41 NodeTypedCountPairs* node_typed_count_pairs) override {
42 for (NodeSet::const_iterator it = nodes.begin(); it != nodes.end(); ++it) { 42 for (NodeSet::const_iterator it = nodes.begin(); it != nodes.end(); ++it) {
43 const BookmarkNode* node = *it; 43 const BookmarkNode* node = *it;
44 std::map<GURL, int>::const_iterator found = 44 std::map<GURL, int>::const_iterator found =
45 typed_count_map_.find(node->url()); 45 typed_count_map_.find(node->GetTitledUrlNodeUrl());
46 if (found == typed_count_map_.end()) 46 if (found == typed_count_map_.end())
47 continue; 47 continue;
48 48
49 node_typed_count_pairs->push_back(std::make_pair(node, found->second)); 49 node_typed_count_pairs->push_back(std::make_pair(node, found->second));
50 } 50 }
51 } 51 }
52 52
53 private: 53 private:
54 const std::map<GURL, int> typed_count_map_; 54 const std::map<GURL, int> typed_count_map_;
55 55
(...skipping 499 matching lines...) Expand 10 before | Expand all | Expand 10 after
555 // Select top two matches. 555 // Select top two matches.
556 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches); 556 model->GetBookmarksMatching(ASCIIToUTF16("google"), 2, &matches);
557 557
558 ASSERT_EQ(2U, matches.size()); 558 ASSERT_EQ(2U, matches.size());
559 EXPECT_EQ(data[0].url, matches[0].node->url()); 559 EXPECT_EQ(data[0].url, matches[0].node->url());
560 EXPECT_EQ(data[3].url, matches[1].node->url()); 560 EXPECT_EQ(data[3].url, matches[1].node->url());
561 } 561 }
562 562
563 } // namespace 563 } // namespace
564 } // namespace bookmarks 564 } // namespace bookmarks
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698