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

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: Move GetEncryptionKey logic into GetUpdates 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 58bd0d1e68694b792b4a0daff886d671106a5fc5..4cec4da5ffce34bd00f04a7414c7f94a726d7c6a 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"
@@ -428,7 +429,7 @@ void MockConnectionManager::ProcessGetUpdates(
if (!updates->entries(i).deleted()) {
ModelType entry_type = syncer::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.";
}
}
@@ -448,9 +449,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