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

Unified Diff: sync/js/sync_js_controller_unittest.cc

Issue 231013003: Remove Sync JS generic request/reply framework (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Remove js_reply_handler.h from gyp Created 6 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
« no previous file with comments | « sync/js/sync_js_controller.cc ('k') | sync/sync_core.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/js/sync_js_controller_unittest.cc
diff --git a/sync/js/sync_js_controller_unittest.cc b/sync/js/sync_js_controller_unittest.cc
index eca617c2d4528b5534250ea67c931c3c66e59091..f6f1abf85b752e5edf0af36546ab074be0b4222f 100644
--- a/sync/js/sync_js_controller_unittest.cc
+++ b/sync/js/sync_js_controller_unittest.cc
@@ -6,7 +6,6 @@
#include "base/message_loop/message_loop.h"
#include "base/values.h"
-#include "sync/js/js_arg_list.h"
#include "sync/js/js_event_details.h"
#include "sync/js/js_test_util.h"
#include "testing/gmock/include/gmock/gmock.h"
@@ -30,91 +29,6 @@ class SyncJsControllerTest : public testing::Test {
base::MessageLoop message_loop_;
};
-ACTION_P(ReplyToMessage, reply_name) {
- arg2.Call(FROM_HERE, &JsReplyHandler::HandleJsReply, reply_name, JsArgList());
-}
-
-TEST_F(SyncJsControllerTest, Messages) {
- InSequence dummy;
- // |mock_backend| needs to outlive |sync_js_controller|.
- StrictMock<MockJsBackend> mock_backend;
- StrictMock<MockJsReplyHandler> mock_reply_handler;
- SyncJsController sync_js_controller;
-
- base::ListValue arg_list1, arg_list2;
- arg_list1.Append(new base::FundamentalValue(false));
- arg_list2.Append(new base::FundamentalValue(5));
- JsArgList args1(&arg_list1), args2(&arg_list2);
-
- EXPECT_CALL(mock_backend, SetJsEventHandler(_));
- EXPECT_CALL(mock_backend, ProcessJsMessage("test1", HasArgs(args2), _))
- .WillOnce(ReplyToMessage("test1_reply"));
- EXPECT_CALL(mock_backend, ProcessJsMessage("test2", HasArgs(args1), _))
- .WillOnce(ReplyToMessage("test2_reply"));
-
- sync_js_controller.AttachJsBackend(mock_backend.AsWeakHandle());
- sync_js_controller.ProcessJsMessage("test1",
- args2,
- mock_reply_handler.AsWeakHandle());
- sync_js_controller.ProcessJsMessage("test2",
- args1,
- mock_reply_handler.AsWeakHandle());
-
- // The replies should be waiting on our message loop.
- EXPECT_CALL(mock_reply_handler, HandleJsReply("test1_reply", _));
- EXPECT_CALL(mock_reply_handler, HandleJsReply("test2_reply", _));
- PumpLoop();
-
- // Let destructor of |sync_js_controller| call RemoveBackend().
-}
-
-TEST_F(SyncJsControllerTest, QueuedMessages) {
- // |mock_backend| needs to outlive |sync_js_controller|.
- StrictMock<MockJsBackend> mock_backend;
- StrictMock<MockJsReplyHandler> mock_reply_handler;
- SyncJsController sync_js_controller;
-
- base::ListValue arg_list1, arg_list2;
- arg_list1.Append(new base::FundamentalValue(false));
- arg_list2.Append(new base::FundamentalValue(5));
- JsArgList args1(&arg_list1), args2(&arg_list2);
-
- // Should queue messages.
- sync_js_controller.ProcessJsMessage(
- "test1",
- args2,
- mock_reply_handler.AsWeakHandle());
- sync_js_controller.ProcessJsMessage(
- "test2",
- args1,
- mock_reply_handler.AsWeakHandle());
-
- // Should do nothing.
- PumpLoop();
- Mock::VerifyAndClearExpectations(&mock_backend);
-
-
- // Should call the queued messages.
- EXPECT_CALL(mock_backend, SetJsEventHandler(_));
- EXPECT_CALL(mock_backend, ProcessJsMessage("test1", HasArgs(args2), _))
- .WillOnce(ReplyToMessage("test1_reply"));
- EXPECT_CALL(mock_backend, ProcessJsMessage("test2", HasArgs(args1), _))
- .WillOnce(ReplyToMessage("test2_reply"));
- EXPECT_CALL(mock_reply_handler, HandleJsReply("test1_reply", _));
- EXPECT_CALL(mock_reply_handler, HandleJsReply("test2_reply", _));
-
- sync_js_controller.AttachJsBackend(mock_backend.AsWeakHandle());
- PumpLoop();
-
- // Should do nothing.
- sync_js_controller.AttachJsBackend(WeakHandle<JsBackend>());
- PumpLoop();
-
- // Should also do nothing.
- sync_js_controller.AttachJsBackend(WeakHandle<JsBackend>());
- PumpLoop();
-}
-
TEST_F(SyncJsControllerTest, Events) {
InSequence dummy;
SyncJsController sync_js_controller;
« no previous file with comments | « sync/js/sync_js_controller.cc ('k') | sync/sync_core.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698