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

Unified Diff: chrome/browser/ui/search/search_ipc_router_unittest.cc

Issue 701973002: Separate checking the user identity and checking if the user is syncing his history in two differen… (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Answered mathp Created 6 years, 1 month 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/ui/search/search_ipc_router_unittest.cc
diff --git a/chrome/browser/ui/search/search_ipc_router_unittest.cc b/chrome/browser/ui/search/search_ipc_router_unittest.cc
index 2d33e1f3afb943f12f15f69a1b4f21ff48d3334c..fb0feee94129e2afefbc22a915234ca6d3181a7c 100644
--- a/chrome/browser/ui/search/search_ipc_router_unittest.cc
+++ b/chrome/browser/ui/search/search_ipc_router_unittest.cc
@@ -58,6 +58,7 @@ class MockSearchIPCRouterDelegate : public SearchIPCRouter::Delegate {
void(int position, const base::string16& provider));
MOCK_METHOD1(PasteIntoOmnibox, void(const base::string16&));
MOCK_METHOD1(OnChromeIdentityCheck, void(const base::string16& identity));
+ MOCK_METHOD0(OnHistorySyncCheck, void());
Mathieu 2014/11/06 14:12:52 sorry to be nit-picky, but sometimes you call it H
beaudoin 2014/11/07 16:16:24 Thanks for catching it. Search & Replace mishap. H
};
class MockSearchIPCRouterPolicy : public SearchIPCRouter::Policy {
@@ -73,6 +74,7 @@ class MockSearchIPCRouterPolicy : public SearchIPCRouter::Policy {
MOCK_METHOD0(ShouldProcessLogEvent, bool());
MOCK_METHOD1(ShouldProcessPasteIntoOmnibox, bool(bool));
MOCK_METHOD0(ShouldProcessChromeIdentityCheck, bool());
+ MOCK_METHOD0(ShouldProcessSyncHistoryCheck, bool());
MOCK_METHOD0(ShouldSendSetPromoInformation, bool());
MOCK_METHOD0(ShouldSendSetDisplayInstantResults, bool());
MOCK_METHOD0(ShouldSendSetSuggestionToPrefetch, bool());
@@ -447,6 +449,35 @@ TEST_F(SearchIPCRouterTest, IgnoreChromeIdentityCheckMsg) {
OnMessageReceived(*message);
}
+TEST_F(SearchIPCRouterTest, ProcessHistorySyncCheckMsg) {
+ NavigateAndCommitActiveTab(GURL(chrome::kChromeSearchLocalNtpUrl));
+ SetupMockDelegateAndPolicy();
+ MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
+ EXPECT_CALL(*mock_delegate(), OnHistorySyncCheck()).Times(1);
+ EXPECT_CALL(*policy, ShouldProcessSyncHistoryCheck()).Times(1)
+ .WillOnce(testing::Return(true));
+
+ content::WebContents* contents = web_contents();
+ scoped_ptr<IPC::Message> message(new ChromeViewHostMsg_HistorySyncCheck(
+ contents->GetRoutingID(), GetSearchIPCRouterSeqNo()));
+ OnMessageReceived(*message);
+}
+
+TEST_F(SearchIPCRouterTest, IgnoreHistorySyncCheckMsg) {
+ NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
+ SetupMockDelegateAndPolicy();
+ MockSearchIPCRouterPolicy* policy = GetSearchIPCRouterPolicy();
+
+ EXPECT_CALL(*mock_delegate(), OnHistorySyncCheck()).Times(0);
+ EXPECT_CALL(*policy, ShouldProcessSyncHistoryCheck()).Times(1)
+ .WillOnce(testing::Return(false));
+
+ content::WebContents* contents = web_contents();
+ scoped_ptr<IPC::Message> message(new ChromeViewHostMsg_HistorySyncCheck(
+ contents->GetRoutingID(), GetSearchIPCRouterSeqNo()));
+ OnMessageReceived(*message);
+}
+
TEST_F(SearchIPCRouterTest, ProcessDeleteMostVisitedItemMsg) {
NavigateAndCommitActiveTab(GURL("chrome-search://foo/bar"));
SetupMockDelegateAndPolicy();

Powered by Google App Engine
This is Rietveld 408576698