Chromium Code Reviews| Index: chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc |
| diff --git a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc |
| index dc18a04e4e06d122b03be3b44b79d4cd4770c152..b9d1447cfd0de0a7dbed3ddefbb8497bce0b886e 100644 |
| --- a/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc |
| +++ b/chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc |
| @@ -377,6 +377,44 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, UpdateToNonTypedURL) { |
| ASSERT_EQ(2, GetVisitCountForFirstURL(0)); |
| } |
| +IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, |
|
maniscalco
2015/05/08 19:38:00
Nice test.
|
| + DontSyncUpdatedNonTypedURLs) { |
| + // Checks if a non-typed URL that has been updated (modified) doesn't get |
| + // synced. This is a regression test after fixing a bug where adding a |
| + // non-typed URL was guarded against but later modifying it was not. Since |
| + // "update" is "update or create if missing", non-typed URLs were being |
| + // created. |
| + const GURL kNonTypedURL("http://link.google.com/"); |
| + const GURL kTypedURL("http://typed.google.com/"); |
| + ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; |
| + AddUrlToHistoryWithTransition(0, kNonTypedURL, ui::PAGE_TRANSITION_LINK, |
| + history::SOURCE_BROWSED); |
| + AddUrlToHistoryWithTransition(0, kTypedURL, ui::PAGE_TRANSITION_TYPED, |
| + history::SOURCE_BROWSED); |
| + |
| + // Modify the non-typed URL. It should not get synced. |
| + typed_urls_helper::SetPageTitle(0, kNonTypedURL, "Welcome to Non-Typed URL"); |
| + ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLsAsVerifier()); |
| + |
| + history::VisitVector visits; |
| + // First client has both visits. |
| + visits = typed_urls_helper::GetVisitsForURLFromClient(0, kNonTypedURL); |
| + ASSERT_EQ(1U, visits.size()); |
| + EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition, |
| + ui::PAGE_TRANSITION_LINK)); |
| + visits = typed_urls_helper::GetVisitsForURLFromClient(0, kTypedURL); |
| + ASSERT_EQ(1U, visits.size()); |
| + EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition, |
| + ui::PAGE_TRANSITION_TYPED)); |
| + // Second client has only the typed visit. |
| + visits = typed_urls_helper::GetVisitsForURLFromClient(1, kNonTypedURL); |
| + ASSERT_EQ(0U, visits.size()); |
| + visits = typed_urls_helper::GetVisitsForURLFromClient(1, kTypedURL); |
| + ASSERT_EQ(1U, visits.size()); |
| + EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition, |
| + ui::PAGE_TRANSITION_TYPED)); |
| +} |
| + |
| IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, SyncTypedRedirects) { |
| const base::string16 kHistoryUrl(ASCIIToUTF16("http://typed.google.com/")); |
| const base::string16 kRedirectedHistoryUrl( |