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

Unified Diff: sync/test/engine/mock_connection_manager.cc

Issue 10455012: [Sync] Add support for performing a GetKey on startup. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fred's comments Created 8 years, 5 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: sync/test/engine/mock_connection_manager.cc
diff --git a/sync/test/engine/mock_connection_manager.cc b/sync/test/engine/mock_connection_manager.cc
index 5b5174d4d81666f8bce4e978d75435a136affe06..3739bf3ab8a6018ae663b8f28c9e05847c2fa042 100644
--- a/sync/test/engine/mock_connection_manager.cc
+++ b/sync/test/engine/mock_connection_manager.cc
@@ -11,6 +11,7 @@
#include "base/location.h"
#include "base/stringprintf.h"
#include "sync/engine/syncer_proto_util.h"
+#include "sync/test/engine/test_id_factory.h"
#include "sync/protocol/bookmark_specifics.pb.h"
#include "sync/syncable/directory.h"
#include "sync/syncable/write_transaction.h"
@@ -427,7 +428,7 @@ void MockConnectionManager::ProcessGetUpdates(
if (!updates->entries(i).deleted()) {
ModelType entry_type = GetModelType(updates->entries(i));
EXPECT_TRUE(
- IsModelTypePresentInSpecifics(gu.from_progress_marker(), entry_type))
+ IsModelTypePresentInSpecifics(gu.from_progress_marker(), entry_type))
<< "Syncer did not request updates being provided by the test.";
}
}
@@ -447,9 +448,19 @@ void MockConnectionManager::ProcessGetUpdates(
}
}
+ // Fill the keystore key if requested.
+ if (gu.need_encryption_key())
+ response->mutable_get_updates()->set_encryption_key(keystore_key_);
+
update_queue_.pop_front();
}
+void MockConnectionManager::SetKeystoreKey(const std::string& key) {
+ // Note: this is not a thread-safe set, ok for now. NOT ok if tests
+ // run the syncer on the background thread while this method is called.
+ keystore_key_ = key;
+}
+
bool MockConnectionManager::ShouldConflictThisCommit() {
bool conflict = false;
if (conflict_all_commits_) {

Powered by Google App Engine
This is Rietveld 408576698