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

Side by Side Diff: chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.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
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 "base/i18n/number_formatting.h" 5 #include "base/i18n/number_formatting.h"
6 #include "base/memory/scoped_vector.h" 6 #include "base/memory/scoped_vector.h"
7 #include "base/strings/utf_string_conversions.h" 7 #include "base/strings/utf_string_conversions.h"
8 #include "chrome/browser/sessions/session_service.h" 8 #include "chrome/browser/sessions/session_service.h"
9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h" 9 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 10 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
(...skipping 359 matching lines...) Expand 10 before | Expand all | Expand 10 after
370 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 370 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
371 371
372 // Both clients should have this URL as typed and have two visits synced up. 372 // Both clients should have this URL as typed and have two visits synced up.
373 ASSERT_TRUE(CheckClientsEqual()); 373 ASSERT_TRUE(CheckClientsEqual());
374 urls = GetTypedUrlsFromClient(0); 374 urls = GetTypedUrlsFromClient(0);
375 ASSERT_EQ(1U, urls.size()); 375 ASSERT_EQ(1U, urls.size());
376 ASSERT_EQ(new_url, urls[0].url()); 376 ASSERT_EQ(new_url, urls[0].url());
377 ASSERT_EQ(2, GetVisitCountForFirstURL(0)); 377 ASSERT_EQ(2, GetVisitCountForFirstURL(0));
378 } 378 }
379 379
380 IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
381 DontSyncUpdatedNonTypedURLs) {
382 // Checks if a non-typed URL that has been updated (modified) doesn't get
383 // synced. This is a regression test after fixing a bug where adding a
384 // non-typed URL was guarded against but later modifying it was not. Since
385 // "update" is "update or create if missing", non-typed URLs were being
386 // created.
387 const GURL kNonTypedURL("http://link.google.com/");
388 const GURL kTypedURL("http://typed.google.com/");
389 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
390 AddUrlToHistoryWithTransition(0, kNonTypedURL, ui::PAGE_TRANSITION_LINK,
391 history::SOURCE_BROWSED);
392 AddUrlToHistoryWithTransition(0, kTypedURL, ui::PAGE_TRANSITION_TYPED,
393 history::SOURCE_BROWSED);
394
395 // Modify the non-typed URL. It should not get synced.
396 typed_urls_helper::SetPageTitle(0, kNonTypedURL, "Welcome to Non-Typed URL");
397 ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLsAsVerifier());
398
399 history::VisitVector visits;
400 // First client has both visits.
401 visits = typed_urls_helper::GetVisitsForURLFromClient(0, kNonTypedURL);
402 ASSERT_EQ(1U, visits.size());
403 EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
404 ui::PAGE_TRANSITION_LINK));
405 visits = typed_urls_helper::GetVisitsForURLFromClient(0, kTypedURL);
406 ASSERT_EQ(1U, visits.size());
407 EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
408 ui::PAGE_TRANSITION_TYPED));
409 // Second client has only the typed visit.
410 visits = typed_urls_helper::GetVisitsForURLFromClient(1, kNonTypedURL);
411 ASSERT_EQ(0U, visits.size());
412 visits = typed_urls_helper::GetVisitsForURLFromClient(1, kTypedURL);
413 ASSERT_EQ(1U, visits.size());
414 EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
415 ui::PAGE_TRANSITION_TYPED));
416 }
417
418 IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, SyncTypedRedirects) { 380 IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, SyncTypedRedirects) {
419 const base::string16 kHistoryUrl(ASCIIToUTF16("http://typed.google.com/")); 381 const base::string16 kHistoryUrl(ASCIIToUTF16("http://typed.google.com/"));
420 const base::string16 kRedirectedHistoryUrl( 382 const base::string16 kRedirectedHistoryUrl(
421 ASCIIToUTF16("http://www.typed.google.com/")); 383 ASCIIToUTF16("http://www.typed.google.com/"));
422 ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; 384 ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
423 385
424 // Simulate a typed address that gets redirected by the server to a different 386 // Simulate a typed address that gets redirected by the server to a different
425 // address. 387 // address.
426 GURL initial_url(kHistoryUrl); 388 GURL initial_url(kHistoryUrl);
427 const ui::PageTransition initial_transition = ui::PageTransitionFromInt( 389 const ui::PageTransition initial_transition = ui::PageTransitionFromInt(
(...skipping 96 matching lines...) Expand 10 before | Expand all | Expand 10 after
524 // - this should not cause a crash. 486 // - this should not cause a crash.
525 AddUrlToHistory(0, bookmark_url); 487 AddUrlToHistory(0, bookmark_url);
526 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1))); 488 ASSERT_TRUE(GetClient(0)->AwaitMutualSyncCycleCompletion(GetClient(1)));
527 489
528 ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLsAsVerifier()); 490 ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLsAsVerifier());
529 history::URLRows urls = GetTypedUrlsFromClient(0); 491 history::URLRows urls = GetTypedUrlsFromClient(0);
530 ASSERT_EQ(1U, urls.size()); 492 ASSERT_EQ(1U, urls.size());
531 ASSERT_EQ(bookmark_url, urls[0].url()); 493 ASSERT_EQ(bookmark_url, urls[0].url());
532 ASSERT_EQ(1, GetVisitCountForFirstURL(0)); 494 ASSERT_EQ(1, GetVisitCountForFirstURL(0));
533 } 495 }
OLDNEW
« no previous file with comments | « chrome/browser/sync/glue/typed_url_change_processor.cc ('k') | chrome/browser/sync/test/integration/typed_urls_helper.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698