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

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

Issue 694843002: Remove NOTIFICATION_HISTORY_URLS_MODIFIED (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 6 years, 1 month 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
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/files/file_path.h" 9 #include "base/files/file_path.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 bitmap.eraseColor(SK_ColorBLUE); 62 bitmap.eraseColor(SK_ColorBLUE);
63 return bitmap; 63 return bitmap;
64 } 64 }
65 65
66 } // namespace 66 } // namespace
67 67
68 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate { 68 class AndroidProviderBackendDelegate : public HistoryBackend::Delegate {
69 public: 69 public:
70 AndroidProviderBackendDelegate() {} 70 AndroidProviderBackendDelegate() {}
71 71
72 virtual void NotifyProfileError(sql::InitStatus init_status) override {} 72 void NotifyProfileError(sql::InitStatus init_status) override {}
73 virtual void SetInMemoryBackend( 73 void SetInMemoryBackend(
74 scoped_ptr<InMemoryHistoryBackend> backend) override {} 74 scoped_ptr<InMemoryHistoryBackend> backend) override {}
75 virtual void NotifyAddVisit(const history::BriefVisitInfo& info) override {} 75 void NotifyAddVisit(const history::BriefVisitInfo& info) override {}
76 virtual void NotifyFaviconChanged(const std::set<GURL>& url) override { 76 void NotifyFaviconChanged(const std::set<GURL>& url) override {
77 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end())); 77 favicon_changed_.reset(new std::set<GURL>(url.begin(), url.end()));
78 } 78 }
79 virtual void NotifyURLVisited(ui::PageTransition, 79 void NotifyURLVisited(ui::PageTransition,
80 const history::URLRow& row, 80 const history::URLRow& row,
81 const history::RedirectList& redirects, 81 const history::RedirectList& redirects,
82 base::Time visit_time) override {} 82 base::Time visit_time) override {}
83 virtual void BroadcastNotifications( 83 void NotifyURLsModified(const history::URLRows& rows) override {
84 modified_details_.reset(new history::URLRows(rows));
85 }
86 void BroadcastNotifications(
84 int type, 87 int type,
85 scoped_ptr<HistoryDetails> details) override { 88 scoped_ptr<HistoryDetails> details) override {
86 switch (type) { 89 DCHECK_EQ(type, chrome::NOTIFICATION_HISTORY_URLS_DELETED);
87 case chrome::NOTIFICATION_HISTORY_URLS_DELETED: { 90 scoped_ptr<URLsDeletedDetails> urls_deleted_details(
88 scoped_ptr<URLsDeletedDetails> urls_deleted_details( 91 static_cast<URLsDeletedDetails*>(details.release()));
89 static_cast<URLsDeletedDetails*>(details.release())); 92 deleted_details_.reset(new history::URLRows(urls_deleted_details->rows));
90 deleted_details_.reset(new history::URLRows(
91 urls_deleted_details->rows));
92 break;
93 }
94 case chrome::NOTIFICATION_HISTORY_URLS_MODIFIED: {
95 scoped_ptr<URLsModifiedDetails> urls_modified_details(
96 static_cast<URLsModifiedDetails*>(details.release()));
97 modified_details_.reset(new history::URLRows(
98 urls_modified_details->changed_urls));
99 break;
100 }
101 }
102 } 93 }
103 virtual void DBLoaded() override {} 94 void DBLoaded() override {}
104 95
105 history::URLRows* deleted_details() const { return deleted_details_.get(); } 96 history::URLRows* deleted_details() const { return deleted_details_.get(); }
106 97
107 history::URLRows* modified_details() const { return modified_details_.get(); } 98 history::URLRows* modified_details() const { return modified_details_.get(); }
108 99
109 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); } 100 std::set<GURL>* favicon_changed() const { return favicon_changed_.get(); }
110 101
111 void ResetDetails() { 102 void ResetDetails() {
112 deleted_details_.reset(); 103 deleted_details_.reset();
113 modified_details_.reset(); 104 modified_details_.reset();
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after
167 class AndroidProviderBackendTest : public testing::Test { 158 class AndroidProviderBackendTest : public testing::Test {
168 public: 159 public:
169 AndroidProviderBackendTest() 160 AndroidProviderBackendTest()
170 : thumbnail_db_(NULL), 161 : thumbnail_db_(NULL),
171 profile_manager_( 162 profile_manager_(
172 TestingBrowserProcess::GetGlobal()), 163 TestingBrowserProcess::GetGlobal()),
173 bookmark_model_(NULL), 164 bookmark_model_(NULL),
174 ui_thread_(BrowserThread::UI, &message_loop_), 165 ui_thread_(BrowserThread::UI, &message_loop_),
175 file_thread_(BrowserThread::FILE, &message_loop_) { 166 file_thread_(BrowserThread::FILE, &message_loop_) {
176 } 167 }
177 virtual ~AndroidProviderBackendTest() {} 168 ~AndroidProviderBackendTest() override {}
178 169
179 protected: 170 protected:
180 virtual void SetUp() override { 171 void SetUp() override {
181 // Setup the testing profile, so the bookmark_model_sql_handler could 172 // Setup the testing profile, so the bookmark_model_sql_handler could
182 // get the bookmark model from it. 173 // get the bookmark model from it.
183 ASSERT_TRUE(profile_manager_.SetUp()); 174 ASSERT_TRUE(profile_manager_.SetUp());
184 // It seems that the name has to be chrome::kInitialProfile, so it 175 // It seems that the name has to be chrome::kInitialProfile, so it
185 // could be found by ProfileManager::GetLastUsedProfile(). 176 // could be found by ProfileManager::GetLastUsedProfile().
186 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile( 177 TestingProfile* testing_profile = profile_manager_.CreateTestingProfile(
187 chrome::kInitialProfile); 178 chrome::kInitialProfile);
188 testing_profile->CreateBookmarkModel(true); 179 testing_profile->CreateBookmarkModel(true);
189 bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile); 180 bookmark_model_ = BookmarkModelFactory::GetForProfile(testing_profile);
190 history_client_ = 181 history_client_ =
(...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after
2151 update_args, &update_count)); 2142 update_args, &update_count));
2152 // Verify notifications. 2143 // Verify notifications.
2153 EXPECT_FALSE(notifier_.deleted_details()); 2144 EXPECT_FALSE(notifier_.deleted_details());
2154 ASSERT_TRUE(notifier_.modified_details()); 2145 ASSERT_TRUE(notifier_.modified_details());
2155 ASSERT_EQ(1u, notifier_.modified_details()->size()); 2146 ASSERT_EQ(1u, notifier_.modified_details()->size());
2156 // No favicon will be updated as thumbnail database is missing. 2147 // No favicon will be updated as thumbnail database is missing.
2157 EXPECT_FALSE(notifier_.favicon_changed()); 2148 EXPECT_FALSE(notifier_.favicon_changed());
2158 } 2149 }
2159 2150
2160 } // namespace history 2151 } // namespace history
OLDNEW
« no previous file with comments | « chrome/browser/chrome_notification_types.h ('k') | chrome/browser/history/history_backend.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698