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

Side by Side Diff: chrome/browser/history/android/android_provider_backend_unittest.cc

Issue 15275004: bookmarks: Get rid of the dependency on history_notifications.h (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: more android fixes 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 "chrome/browser/history/android/android_provider_backend.h" 5 #include "chrome/browser/history/android/android_provider_backend.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
53 } // namespace 53 } // namespace
54 54
55 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate { 55 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate {
56 public: 56 public:
57 AndroidProviderBackendDelegate() {} 57 AndroidProviderBackendDelegate() {}
58 58
59 virtual void NotifyProfileError(int backend_id, 59 virtual void NotifyProfileError(int backend_id,
60 sql::InitStatus init_status) OVERRIDE {} 60 sql::InitStatus init_status) OVERRIDE {}
61 virtual void SetInMemoryBackend(int backend_id, 61 virtual void SetInMemoryBackend(int backend_id,
62 InMemoryHistoryBackend* backend) OVERRIDE {} 62 InMemoryHistoryBackend* backend) OVERRIDE {}
63 virtual void SendFaviconChangedNotification(
64 chrome::FaviconChangedDetails* details) OVERRIDE {
65 favicon_details_.reset(details);
66 }
63 virtual void BroadcastNotifications(int type, 67 virtual void BroadcastNotifications(int type,
64 HistoryDetails* details) OVERRIDE { 68 HistoryDetails* details) OVERRIDE {
65 switch (type) { 69 switch (type) {
66 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: 70 case chrome::NOTIFICATION_HISTORY_URLS_DELETED:
67 deleted_details_.reset(static_cast<URLsDeletedDetails*>(details)); 71 deleted_details_.reset(static_cast<URLsDeletedDetails*>(details));
68 break; 72 break;
69 case chrome::NOTIFICATION_FAVICON_CHANGED:
70 favicon_details_.reset(static_cast<FaviconChangeDetails*>(details));
71 break;
72 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: 73 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED:
73 modified_details_.reset(static_cast<URLsModifiedDetails*>(details)); 74 modified_details_.reset(static_cast<URLsModifiedDetails*>(details));
74 break; 75 break;
75 } 76 }
76 } 77 }
77 virtual void DBLoaded(int backend_id) OVERRIDE {} 78 virtual void DBLoaded(int backend_id) OVERRIDE {}
78 virtual void StartTopSitesMigration(int backend_id) OVERRIDE {} 79 virtual void StartTopSitesMigration(int backend_id) OVERRIDE {}
79 virtual void NotifyVisitDBObserversOnAddVisit( 80 virtual void NotifyVisitDBObserversOnAddVisit(
80 const history::BriefVisitInfo& info) OVERRIDE {} 81 const history::BriefVisitInfo& info) OVERRIDE {}
81 82
82 URLsDeletedDetails* deleted_details() const { 83 URLsDeletedDetails* deleted_details() const {
83 return deleted_details_.get(); 84 return deleted_details_.get();
84 } 85 }
85 86
86 URLsModifiedDetails* modified_details() const { 87 URLsModifiedDetails* modified_details() const {
87 return modified_details_.get(); 88 return modified_details_.get();
88 } 89 }
89 90
90 FaviconChangeDetails* favicon_details() const { 91 chrome::FaviconChangedDetails* favicon_details() const {
91 return favicon_details_.get(); 92 return favicon_details_.get();
92 } 93 }
93 94
94 void ResetDetails() { 95 void ResetDetails() {
95 deleted_details_.reset(); 96 deleted_details_.reset();
96 modified_details_.reset(); 97 modified_details_.reset();
97 favicon_details_.reset(); 98 favicon_details_.reset();
98 } 99 }
99 100
100 private: 101 private:
101 scoped_ptr<URLsDeletedDetails> deleted_details_; 102 scoped_ptr<URLsDeletedDetails> deleted_details_;
102 scoped_ptr<URLsModifiedDetails> modified_details_; 103 scoped_ptr<URLsModifiedDetails> modified_details_;
103 scoped_ptr<FaviconChangeDetails> favicon_details_; 104 scoped_ptr<chrome::FaviconChangedDetails> favicon_details_;
104 105
105 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackendDelegate); 106 DISALLOW_COPY_AND_ASSIGN(AndroidProviderBackendDelegate);
106 }; 107 };
107 108
108 class AndroidProviderBackendTest : public testing::Test { 109 class AndroidProviderBackendTest : public testing::Test {
109 public: 110 public:
110 AndroidProviderBackendTest() 111 AndroidProviderBackendTest()
111 : profile_manager_( 112 : profile_manager_(
112 TestingBrowserProcess::GetGlobal()), 113 TestingBrowserProcess::GetGlobal()),
113 bookmark_model_(NULL), 114 bookmark_model_(NULL),
(...skipping 1956 matching lines...) Expand 10 before | Expand all | Expand 10 after
2070 update_args, &update_count)); 2071 update_args, &update_count));
2071 // Verify notifications. 2072 // Verify notifications.
2072 EXPECT_FALSE(delegate_.deleted_details()); 2073 EXPECT_FALSE(delegate_.deleted_details());
2073 ASSERT_TRUE(delegate_.modified_details()); 2074 ASSERT_TRUE(delegate_.modified_details());
2074 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size()); 2075 ASSERT_EQ(1u, delegate_.modified_details()->changed_urls.size());
2075 // No favicon will be updated as thumbnail database is missing. 2076 // No favicon will be updated as thumbnail database is missing.
2076 EXPECT_FALSE(delegate_.favicon_details()); 2077 EXPECT_FALSE(delegate_.favicon_details());
2077 } 2078 }
2078 2079
2079 } // namespace history 2080 } // namespace history
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698