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

Unified Diff: chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.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 side-by-side diff with in-line comments
Download patch
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(

Powered by Google App Engine
This is Rietveld 408576698