Commit 9586f7bf authored by zea's avatar zea Committed by Commit bot

[Sync] Sync the chrome://history page

Whitelist the chrome history page so that it can trigger starting up the sync
engine. It gets special treatment since it's where the other devices UI lives.

BUG=476678

Review URL: https://codereview.chromium.org/1062013003

Cr-Commit-Position: refs/heads/master@{#325489}
parent 5427df28
...@@ -39,6 +39,10 @@ bool ShouldSyncTab(const SyncedTabDelegate& tab) { ...@@ -39,6 +39,10 @@ bool ShouldSyncTab(const SyncedTabDelegate& tab) {
!virtual_url.SchemeIs(chrome::kChromeNativeScheme) && !virtual_url.SchemeIs(chrome::kChromeNativeScheme) &&
!virtual_url.SchemeIsFile()) { !virtual_url.SchemeIsFile()) {
found_valid_url = true; found_valid_url = true;
} else if (virtual_url == GURL(chrome::kChromeUIHistoryURL)) {
// The history page is treated specially as we want it to trigger syncable
// events for UI purposes.
found_valid_url = true;
} }
} }
return found_valid_url; return found_valid_url;
......
...@@ -9,6 +9,7 @@ ...@@ -9,6 +9,7 @@
#include "chrome/browser/sync/test/integration/sync_integration_test_util.h" #include "chrome/browser/sync/test/integration/sync_integration_test_util.h"
#include "chrome/browser/sync/test/integration/sync_test.h" #include "chrome/browser/sync/test/integration/sync_test.h"
#include "chrome/browser/sync/test/integration/typed_urls_helper.h" #include "chrome/browser/sync/test/integration/typed_urls_helper.h"
#include "chrome/common/url_constants.h"
#include "components/history/core/browser/history_types.h" #include "components/history/core/browser/history_types.h"
#include "components/sessions/session_types.h" #include "components/sessions/session_types.h"
#include "sync/test/fake_server/fake_server_verifier.h" #include "sync/test/fake_server/fake_server_verifier.h"
...@@ -19,10 +20,12 @@ using fake_server::SessionsHierarchy; ...@@ -19,10 +20,12 @@ using fake_server::SessionsHierarchy;
using sessions_helper::CheckInitialState; using sessions_helper::CheckInitialState;
using sessions_helper::GetLocalWindows; using sessions_helper::GetLocalWindows;
using sessions_helper::GetSessionData; using sessions_helper::GetSessionData;
using sessions_helper::ModelAssociatorHasTabWithUrl;
using sessions_helper::OpenTabAndGetLocalWindows; using sessions_helper::OpenTabAndGetLocalWindows;
using sessions_helper::ScopedWindowMap; using sessions_helper::ScopedWindowMap;
using sessions_helper::SessionWindowMap; using sessions_helper::SessionWindowMap;
using sessions_helper::SyncedSessionVector; using sessions_helper::SyncedSessionVector;
using sessions_helper::WaitForTabsToLoad;
using sessions_helper::WindowsMatch; using sessions_helper::WindowsMatch;
using sync_integration_test_util::AwaitCommitActivityCompletion; using sync_integration_test_util::AwaitCommitActivityCompletion;
using typed_urls_helper::GetUrlFromClient; using typed_urls_helper::GetUrlFromClient;
...@@ -36,14 +39,7 @@ class SingleClientSessionsSyncTest : public SyncTest { ...@@ -36,14 +39,7 @@ class SingleClientSessionsSyncTest : public SyncTest {
DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest); DISALLOW_COPY_AND_ASSIGN(SingleClientSessionsSyncTest);
}; };
// Timeout on Windows, see http://crbug.com/99819 IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, Sanity) {
#if defined(OS_WIN)
#define MAYBE_Sanity DISABLED_Sanity
#else
#define MAYBE_Sanity Sanity
#endif
IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, MAYBE_Sanity) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(CheckInitialState(0)); ASSERT_TRUE(CheckInitialState(0));
...@@ -78,6 +74,25 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, NoSessions) { ...@@ -78,6 +74,25 @@ IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, NoSessions) {
ASSERT_TRUE(fake_server_verifier.VerifySessions(expected_sessions)); ASSERT_TRUE(fake_server_verifier.VerifySessions(expected_sessions));
} }
IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, ChromeHistory) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
ASSERT_TRUE(CheckInitialState(0));
// Add a new session to client 0 and wait for it to sync.
ScopedWindowMap old_windows;
ASSERT_TRUE(OpenTabAndGetLocalWindows(0,
GURL(chrome::kChromeUIHistoryURL),
old_windows.GetMutable()));
std::vector<GURL> urls;
urls.push_back(GURL(chrome::kChromeUIHistoryURL));
ASSERT_TRUE(WaitForTabsToLoad(0, urls));
// Verify the chrome history page synced.
ASSERT_TRUE(ModelAssociatorHasTabWithUrl(0,
GURL(chrome::kChromeUIHistoryURL)));
}
IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TimestampMatchesHistory) { IN_PROC_BROWSER_TEST_F(SingleClientSessionsSyncTest, TimestampMatchesHistory) {
ASSERT_TRUE(SetupSync()) << "SetupSync() failed."; ASSERT_TRUE(SetupSync()) << "SetupSync() failed.";
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment