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

Unified Diff: chrome/browser/sync/js/js_sync_manager_observer_unittest.cc

Issue 7982049: [Sync] Move some code into new class JsMutationEventObserver (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix deps Created 9 years, 3 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/js/js_sync_manager_observer_unittest.cc
diff --git a/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc b/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc
index 776e4261b5b7b32b6fa0a6936bec7708f1240d60..aa1f0f1f282a13129705ac0cc393c73ea2bcfd67 100644
--- a/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc
+++ b/chrome/browser/sync/js/js_sync_manager_observer_unittest.cc
@@ -8,7 +8,6 @@
#include "base/location.h"
#include "base/message_loop.h"
#include "base/values.h"
-#include "chrome/browser/sync/js/js_arg_list.h"
#include "chrome/browser/sync/js/js_event_details.h"
#include "chrome/browser/sync/js/js_test_util.h"
#include "chrome/browser/sync/protocol/sync_protocol_error.h"
@@ -68,27 +67,6 @@ TEST_F(JsSyncManagerObserverTest, NoArgNotifiations) {
PumpLoop();
}
-TEST_F(JsSyncManagerObserverTest, OnChangesComplete) {
- InSequence dummy;
-
- for (int i = syncable::FIRST_REAL_MODEL_TYPE;
- i < syncable::MODEL_TYPE_COUNT; ++i) {
- DictionaryValue expected_details;
- expected_details.SetString(
- "modelType",
- syncable::ModelTypeToString(syncable::ModelTypeFromInt(i)));
- EXPECT_CALL(mock_js_event_handler_,
- HandleJsEvent("onChangesComplete",
- HasDetailsAsDictionary(expected_details)));
- }
-
- for (int i = syncable::FIRST_REAL_MODEL_TYPE;
- i < syncable::MODEL_TYPE_COUNT; ++i) {
- js_sync_manager_observer_.OnChangesComplete(syncable::ModelTypeFromInt(i));
- }
- PumpLoop();
-}
-
TEST_F(JsSyncManagerObserverTest, OnSyncCycleCompleted) {
std::string download_progress_markers[syncable::MODEL_TYPE_COUNT];
sessions::SyncSessionSnapshot snapshot(sessions::SyncerStatus(),
@@ -234,66 +212,5 @@ TEST_F(JsSyncManagerObserverTest, OnEncryptionComplete) {
PumpLoop();
}
-TEST_F(JsSyncManagerObserverTest, OnChangesApplied) {
- InSequence dummy;
-
- // We don't test with passwords as that requires additional setup.
-
- // Build a list of example ChangeRecords.
- sync_api::ChangeRecord changes[syncable::MODEL_TYPE_COUNT];
- for (int i = syncable::AUTOFILL_PROFILE;
- i < syncable::MODEL_TYPE_COUNT; ++i) {
- changes[i].id = i;
- switch (i % 3) {
- case 0:
- changes[i].action =
- sync_api::ChangeRecord::ACTION_ADD;
- break;
- case 1:
- changes[i].action =
- sync_api::ChangeRecord::ACTION_UPDATE;
- break;
- default:
- changes[i].action =
- sync_api::ChangeRecord::ACTION_DELETE;
- break;
- }
- }
-
- // For each i, we call OnChangesApplied() with the first arg equal
- // to i cast to ModelType and the second argument with the changes
- // starting from changes[i].
-
- // Set expectations for each data type.
- for (int i = syncable::AUTOFILL_PROFILE;
- i < syncable::MODEL_TYPE_COUNT; ++i) {
- const std::string& model_type_str =
- syncable::ModelTypeToString(syncable::ModelTypeFromInt(i));
- DictionaryValue expected_details;
- expected_details.SetString("modelType", model_type_str);
- expected_details.SetString("writeTransactionId", "0");
- ListValue* expected_changes = new ListValue();
- expected_details.Set("changes", expected_changes);
- for (int j = i; j < syncable::MODEL_TYPE_COUNT; ++j) {
- expected_changes->Append(changes[j].ToValue());
- }
- EXPECT_CALL(mock_js_event_handler_,
- HandleJsEvent("onChangesApplied",
- HasDetailsAsDictionary(expected_details)));
- }
-
- // Fire OnChangesApplied() for each data type.
- for (int i = syncable::AUTOFILL_PROFILE;
- i < syncable::MODEL_TYPE_COUNT; ++i) {
- sync_api::ChangeRecordList
- local_changes(changes + i, changes + arraysize(changes));
- js_sync_manager_observer_.OnChangesApplied(
- syncable::ModelTypeFromInt(i),
- 0, sync_api::ImmutableChangeRecordList(&local_changes));
- }
-
- PumpLoop();
-}
-
} // namespace
} // namespace browser_sync
« no previous file with comments | « chrome/browser/sync/js/js_sync_manager_observer.cc ('k') | chrome/browser/sync/js/js_transaction_observer.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698