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

Unified Diff: chrome/browser/sync/test/integration/two_client_typed_urls_sync_test.cc

Issue 1087773002: Sync typed urls with typed_cont() == 0 (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unit test Created 5 years, 8 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 0b9279c5824ac49d771d7c22e8efc72ae3363bdb..dc18a04e4e06d122b03be3b44b79d4cd4770c152 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,52 @@ IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, UpdateToNonTypedURL) {
ASSERT_EQ(2, GetVisitCountForFirstURL(0));
}
+IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest, SyncTypedRedirects) {
Nicolas Zea 2015/04/20 19:46:03 nit: add a comment describing the purpose of the t
+ const base::string16 kHistoryUrl(ASCIIToUTF16("http://typed.google.com/"));
+ const base::string16 kRedirectedHistoryUrl(
+ ASCIIToUTF16("http://www.typed.google.com/"));
+ ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
+
+ // Simulate a typed address that gets redirected by the server to a different
+ // address.
+ GURL initial_url(kHistoryUrl);
+ const ui::PageTransition initial_transition = ui::PageTransitionFromInt(
+ ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_CHAIN_START);
+ AddUrlToHistoryWithTransition(0, initial_url, initial_transition,
+ history::SOURCE_BROWSED);
+
+ GURL redirected_url(kRedirectedHistoryUrl);
+ const ui::PageTransition redirected_transition = ui::PageTransitionFromInt(
+ ui::PAGE_TRANSITION_TYPED | ui::PAGE_TRANSITION_CHAIN_END |
+ ui::PAGE_TRANSITION_SERVER_REDIRECT);
+ // This address will have a typed_count == 0 because it's a redirection.
+ // It should still be synced.
+ AddUrlToHistoryWithTransition(0, redirected_url, redirected_transition,
+ history::SOURCE_BROWSED);
+
+ // Both clients should have both URLs.
+ ASSERT_TRUE(AwaitCheckAllProfilesHaveSameURLsAsVerifier());
+
+ history::VisitVector visits =
+ typed_urls_helper::GetVisitsForURLFromClient(0, initial_url);
+ ASSERT_EQ(1U, visits.size());
+ EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
+ ui::PAGE_TRANSITION_TYPED));
+ visits = typed_urls_helper::GetVisitsForURLFromClient(0, redirected_url);
+ ASSERT_EQ(1U, visits.size());
+ EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
+ ui::PAGE_TRANSITION_TYPED));
+
+ visits = typed_urls_helper::GetVisitsForURLFromClient(1, initial_url);
+ ASSERT_EQ(1U, visits.size());
+ EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
+ ui::PAGE_TRANSITION_TYPED));
+ visits = typed_urls_helper::GetVisitsForURLFromClient(1, redirected_url);
+ ASSERT_EQ(1U, visits.size());
+ EXPECT_TRUE(ui::PageTransitionCoreTypeIs(visits[0].transition,
+ ui::PAGE_TRANSITION_TYPED));
+}
+
IN_PROC_BROWSER_TEST_F(TwoClientTypedUrlsSyncTest,
SkipImportedVisits) {
« 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