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

Unified Diff: sync/internal_api/sync_manager_impl_unittest.cc

Issue 224563004: sync: Re-implement getAllNodes WebUI function (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Comment fix Created 6 years, 9 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/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: sync/internal_api/sync_manager_impl_unittest.cc
diff --git a/sync/internal_api/sync_manager_impl_unittest.cc b/sync/internal_api/sync_manager_impl_unittest.cc
index 7da7070223e9221818f21b71363f0d94c2c07efd..a8ee0be57e72f39dbad40494e5e7076aa9e69e44 100644
--- a/sync/internal_api/sync_manager_impl_unittest.cc
+++ b/sync/internal_api/sync_manager_impl_unittest.cc
@@ -42,10 +42,8 @@
#include "sync/internal_api/sync_encryption_handler_impl.h"
#include "sync/internal_api/sync_manager_impl.h"
#include "sync/internal_api/syncapi_internal.h"
-#include "sync/js/js_arg_list.h"
#include "sync/js/js_backend.h"
#include "sync/js/js_event_handler.h"
-#include "sync/js/js_reply_handler.h"
#include "sync/js/js_test_util.h"
#include "sync/notifier/fake_invalidation_handler.h"
#include "sync/notifier/invalidation_handler.h"
@@ -754,6 +752,7 @@ class SyncManagerTest : public testing::Test,
sync_manager_.GetUserShare(), i->first);
}
}
+
PumpLoop();
}
@@ -836,13 +835,6 @@ class SyncManagerTest : public testing::Test,
message_loop_.RunUntilIdle();
}
- void SendJsMessage(const std::string& name, const JsArgList& args,
- const WeakHandle<JsReplyHandler>& reply_handler) {
- js_backend_.Call(FROM_HERE, &JsBackend::ProcessJsMessage,
- name, args, reply_handler);
- PumpLoop();
- }
-
void SetJsEventHandler(const WeakHandle<JsEventHandler>& event_handler) {
js_backend_.Call(FROM_HERE, &JsBackend::SetJsEventHandler,
event_handler);
@@ -938,42 +930,18 @@ class SyncManagerTest : public testing::Test,
InternalComponentsFactory::Switches switches_;
};
-TEST_F(SyncManagerTest, GetAllNodesTest) {
- StrictMock<MockJsReplyHandler> reply_handler;
- JsArgList return_args;
+TEST_F(SyncManagerTest, GetAllNodesForTypeTest) {
+ ModelSafeRoutingInfo routing_info;
+ GetModelSafeRoutingInfo(&routing_info);
+ sync_manager_.StartSyncingNormally(routing_info);
- EXPECT_CALL(reply_handler,
- HandleJsReply("getAllNodes", _))
- .Times(1).WillRepeatedly(SaveArg<1>(&return_args));
+ scoped_ptr<base::ListValue> node_list(
+ sync_manager_.GetAllNodesForType(syncer::PREFERENCES));
- {
- base::ListValue args;
- SendJsMessage("getAllNodes",
- JsArgList(&args), reply_handler.AsWeakHandle());
- }
-
- // There's not much value in verifying every attribute on every node here.
- // Most of the value of this test has already been achieved: we've verified we
- // can call the above function without crashing or leaking memory.
- //
- // Let's just check the list size and a few of its elements. Anything more
- // would make this test brittle without greatly increasing our chances of
- // catching real bugs.
+ // Should have one node: the type root node.
+ ASSERT_EQ(1U, node_list->GetSize());
- const base::ListValue* node_list;
const base::DictionaryValue* first_result;
-
- // The resulting argument list should have one argument, a list of nodes.
- ASSERT_EQ(1U, return_args.Get().GetSize());
- ASSERT_TRUE(return_args.Get().GetList(0, &node_list));
-
- // The database creation logic depends on the routing info.
- // Refer to setup methods for more information.
- ModelSafeRoutingInfo routes;
- GetModelSafeRoutingInfo(&routes);
- size_t directory_size = routes.size() + 1;
-
- ASSERT_EQ(directory_size, node_list->GetSize());
ASSERT_TRUE(node_list->GetDictionary(0, &first_result));
EXPECT_TRUE(first_result->HasKey("ID"));
EXPECT_TRUE(first_result->HasKey("NON_UNIQUE_NAME"));
« no previous file with comments | « sync/internal_api/sync_manager_impl.cc ('k') | sync/internal_api/test/fake_sync_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698