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

Side by Side Diff: chrome/browser/sync/test/integration/typed_urls_helper.cc

Issue 1126633005: Don't create a sync node when updating an URL that wasn't typed. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
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/sync/test/integration/typed_urls_helper.h" 5 #include "chrome/browser/sync/test/integration/typed_urls_helper.h"
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/strings/utf_string_conversions.h" 8 #include "base/strings/utf_string_conversions.h"
9 #include "base/synchronization/waitable_event.h" 9 #include "base/synchronization/waitable_event.h"
10 #include "base/task/cancelable_task_tracker.h" 10 #include "base/task/cancelable_task_tracker.h"
(...skipping 151 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 const base::Time& timestamp) { 162 const base::Time& timestamp) {
163 service->AddPage(url, 163 service->AddPage(url,
164 timestamp, 164 timestamp,
165 NULL, // scope 165 NULL, // scope
166 1234, // nav_entry_id 166 1234, // nav_entry_id
167 GURL(), // referrer 167 GURL(), // referrer
168 history::RedirectList(), 168 history::RedirectList(),
169 transition, 169 transition,
170 source, 170 source,
171 false); 171 false);
172 service->SetPageTitle(url, base::ASCIIToUTF16(url.spec() + " - title"));
173 } 172 }
174 173
175 history::URLRows GetTypedUrlsFromHistoryService( 174 history::URLRows GetTypedUrlsFromHistoryService(
176 history::HistoryService* service) { 175 history::HistoryService* service) {
177 base::CancelableTaskTracker tracker; 176 base::CancelableTaskTracker tracker;
178 history::URLRows rows; 177 history::URLRows rows;
179 base::WaitableEvent wait_event(true, false); 178 base::WaitableEvent wait_event(true, false);
180 service->ScheduleDBTask( 179 service->ScheduleDBTask(
181 scoped_ptr<history::HistoryDBTask>( 180 scoped_ptr<history::HistoryDBTask>(
182 new GetTypedUrlsTask(&rows, &wait_event)), 181 new GetTypedUrlsTask(&rows, &wait_event)),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
325 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) { 324 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) {
326 HistoryServiceFactory::GetForProfileWithoutCreating( 325 HistoryServiceFactory::GetForProfileWithoutCreating(
327 test()->GetProfile(index))->DeleteURLsForTest(urls); 326 test()->GetProfile(index))->DeleteURLsForTest(urls);
328 if (test()->use_verifier()) 327 if (test()->use_verifier())
329 HistoryServiceFactory::GetForProfile(test()->verifier(), 328 HistoryServiceFactory::GetForProfile(test()->verifier(),
330 ServiceAccessType::IMPLICIT_ACCESS) 329 ServiceAccessType::IMPLICIT_ACCESS)
331 ->DeleteURLsForTest(urls); 330 ->DeleteURLsForTest(urls);
332 WaitForHistoryDBThread(index); 331 WaitForHistoryDBThread(index);
333 } 332 }
334 333
334 void SetPageTitle(int index, const GURL& url, const std::string& title) {
335 HistoryServiceFactory::GetForProfileWithoutCreating(test()->GetProfile(index))
336 ->SetPageTitle(url, base::UTF8ToUTF16(title));
337 if (test()->use_verifier())
338 HistoryServiceFactory::GetForProfile(test()->verifier(),
339 ServiceAccessType::IMPLICIT_ACCESS)
340 ->SetPageTitle(url, base::UTF8ToUTF16(title));
341 WaitForHistoryDBThread(index);
342 }
343
335 bool CheckURLRowVectorsAreEqual(const history::URLRows& left, 344 bool CheckURLRowVectorsAreEqual(const history::URLRows& left,
336 const history::URLRows& right) { 345 const history::URLRows& right) {
337 if (left.size() != right.size()) 346 if (left.size() != right.size())
338 return false; 347 return false;
339 for (size_t i = 0; i < left.size(); ++i) { 348 for (size_t i = 0; i < left.size(); ++i) {
340 // URLs could be out-of-order, so look for a matching URL in the second 349 // URLs could be out-of-order, so look for a matching URL in the second
341 // array. 350 // array.
342 bool found = false; 351 bool found = false;
343 for (size_t j = 0; j < right.size(); ++j) { 352 for (size_t j = 0; j < right.size(); ++j) {
344 if (left[i].url() == right[j].url()) { 353 if (left[i].url() == right[j].url()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
430 439
431 } // namespace 440 } // namespace
432 441
433 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() { 442 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() {
434 ProfilesHaveSameURLsChecker checker; 443 ProfilesHaveSameURLsChecker checker;
435 checker.Wait(); 444 checker.Wait();
436 return !checker.TimedOut(); 445 return !checker.TimedOut();
437 } 446 }
438 447
439 } // namespace typed_urls_helper 448 } // namespace typed_urls_helper
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698