| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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/sync_sessions/revisit/bookmarks_page_revisit_observer.h" | 5 #include "components/sync_sessions/revisit/bookmarks_page_revisit_observer.h" |
| 6 | 6 |
| 7 #include <memory> | 7 #include <memory> |
| 8 #include <vector> | 8 #include <vector> |
| 9 | 9 |
| 10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 } | 32 } |
| 33 | 33 |
| 34 private: | 34 private: |
| 35 const std::vector<const bookmarks::BookmarkNode*>& nodes_; | 35 const std::vector<const bookmarks::BookmarkNode*>& nodes_; |
| 36 }; | 36 }; |
| 37 | 37 |
| 38 } // namespace | 38 } // namespace |
| 39 | 39 |
| 40 void RunObserver(const std::vector<const bookmarks::BookmarkNode*>& nodes) { | 40 void RunObserver(const std::vector<const bookmarks::BookmarkNode*>& nodes) { |
| 41 BookmarksPageRevisitObserver observer( | 41 BookmarksPageRevisitObserver observer( |
| 42 base::WrapUnique(new TestBookmarksByUrlProvider(nodes))); | 42 base::MakeUnique<TestBookmarksByUrlProvider>(nodes)); |
| 43 observer.OnPageVisit(kExampleGurl, PageVisitObserver::kTransitionPage); | 43 observer.OnPageVisit(kExampleGurl, PageVisitObserver::kTransitionPage); |
| 44 } | 44 } |
| 45 | 45 |
| 46 void ExpectMiss(const std::vector<const bookmarks::BookmarkNode*>& nodes) { | 46 void ExpectMiss(const std::vector<const bookmarks::BookmarkNode*>& nodes) { |
| 47 base::HistogramTester histogram_tester; | 47 base::HistogramTester histogram_tester; |
| 48 RunObserver(nodes); | 48 RunObserver(nodes); |
| 49 histogram_tester.ExpectUniqueSample("Sync.PageRevisitBookmarksMissTransition", | 49 histogram_tester.ExpectUniqueSample("Sync.PageRevisitBookmarksMissTransition", |
| 50 PageVisitObserver::kTransitionPage, 1); | 50 PageVisitObserver::kTransitionPage, 1); |
| 51 histogram_tester.ExpectTotalCount("Sync.PageRevisitBookmarksDuration", 1); | 51 histogram_tester.ExpectTotalCount("Sync.PageRevisitBookmarksDuration", 1); |
| 52 } | 52 } |
| (...skipping 23 matching lines...) Expand all Loading... |
| 76 TEST(BookmarksPageRevisitObserver, MultipleMatchingBookmarks) { | 76 TEST(BookmarksPageRevisitObserver, MultipleMatchingBookmarks) { |
| 77 bookmarks::BookmarkNode node1(kExampleGurl); | 77 bookmarks::BookmarkNode node1(kExampleGurl); |
| 78 bookmarks::BookmarkNode node2(kExampleGurl); | 78 bookmarks::BookmarkNode node2(kExampleGurl); |
| 79 std::vector<const bookmarks::BookmarkNode*> nodes; | 79 std::vector<const bookmarks::BookmarkNode*> nodes; |
| 80 nodes.push_back(&node1); | 80 nodes.push_back(&node1); |
| 81 nodes.push_back(&node2); | 81 nodes.push_back(&node2); |
| 82 ExpectMatch(nodes); | 82 ExpectMatch(nodes); |
| 83 } | 83 } |
| 84 | 84 |
| 85 } // namespace sync_sessions | 85 } // namespace sync_sessions |
| OLD | NEW |