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

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

Issue 1127353004: Revert of 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
« no previous file with comments | « chrome/browser/sync/test/integration/typed_urls_helper.h ('k') | no next file » | 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/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"));
172 } 173 }
173 174
174 history::URLRows GetTypedUrlsFromHistoryService( 175 history::URLRows GetTypedUrlsFromHistoryService(
175 history::HistoryService* service) { 176 history::HistoryService* service) {
176 base::CancelableTaskTracker tracker; 177 base::CancelableTaskTracker tracker;
177 history::URLRows rows; 178 history::URLRows rows;
178 base::WaitableEvent wait_event(true, false); 179 base::WaitableEvent wait_event(true, false);
179 service->ScheduleDBTask( 180 service->ScheduleDBTask(
180 scoped_ptr<history::HistoryDBTask>( 181 scoped_ptr<history::HistoryDBTask>(
181 new GetTypedUrlsTask(&rows, &wait_event)), 182 new GetTypedUrlsTask(&rows, &wait_event)),
(...skipping 142 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) { 325 void DeleteUrlsFromHistory(int index, const std::vector<GURL>& urls) {
325 HistoryServiceFactory::GetForProfileWithoutCreating( 326 HistoryServiceFactory::GetForProfileWithoutCreating(
326 test()->GetProfile(index))->DeleteURLsForTest(urls); 327 test()->GetProfile(index))->DeleteURLsForTest(urls);
327 if (test()->use_verifier()) 328 if (test()->use_verifier())
328 HistoryServiceFactory::GetForProfile(test()->verifier(), 329 HistoryServiceFactory::GetForProfile(test()->verifier(),
329 ServiceAccessType::IMPLICIT_ACCESS) 330 ServiceAccessType::IMPLICIT_ACCESS)
330 ->DeleteURLsForTest(urls); 331 ->DeleteURLsForTest(urls);
331 WaitForHistoryDBThread(index); 332 WaitForHistoryDBThread(index);
332 } 333 }
333 334
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
344 bool CheckURLRowVectorsAreEqual(const history::URLRows& left, 335 bool CheckURLRowVectorsAreEqual(const history::URLRows& left,
345 const history::URLRows& right) { 336 const history::URLRows& right) {
346 if (left.size() != right.size()) 337 if (left.size() != right.size())
347 return false; 338 return false;
348 for (size_t i = 0; i < left.size(); ++i) { 339 for (size_t i = 0; i < left.size(); ++i) {
349 // URLs could be out-of-order, so look for a matching URL in the second 340 // URLs could be out-of-order, so look for a matching URL in the second
350 // array. 341 // array.
351 bool found = false; 342 bool found = false;
352 for (size_t j = 0; j < right.size(); ++j) { 343 for (size_t j = 0; j < right.size(); ++j) {
353 if (left[i].url() == right[j].url()) { 344 if (left[i].url() == right[j].url()) {
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 430
440 } // namespace 431 } // namespace
441 432
442 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() { 433 bool AwaitCheckAllProfilesHaveSameURLsAsVerifier() {
443 ProfilesHaveSameURLsChecker checker; 434 ProfilesHaveSameURLsChecker checker;
444 checker.Wait(); 435 checker.Wait();
445 return !checker.TimedOut(); 436 return !checker.TimedOut();
446 } 437 }
447 438
448 } // namespace typed_urls_helper 439 } // namespace typed_urls_helper
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/typed_urls_helper.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698