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

Unified Diff: remoting/protocol/protocol_mock_objects.h

Issue 19714002: Add serialization to PairingRegistry. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 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: remoting/protocol/protocol_mock_objects.h
diff --git a/remoting/protocol/protocol_mock_objects.h b/remoting/protocol/protocol_mock_objects.h
index 84960fdc8ad055802fd99372d243e7cabb7eb331..354195d20d081b8c16e6fc6cffbc4545be7ab41c 100644
--- a/remoting/protocol/protocol_mock_objects.h
+++ b/remoting/protocol/protocol_mock_objects.h
@@ -222,11 +222,33 @@ class MockPairingRegistryDelegate : public PairingRegistry::Delegate {
virtual void Load(
const PairingRegistry::LoadCallback& callback) OVERRIDE;
+ // By default, the Save method runs its callback automatically because the
+ // negotiating authenticator unit test does not provide any hooks to do it
+ // manually. For unit tests that need to verify correct behaviour under
Lambros 2013/07/18 20:34:51 optional: I think it's strange to have the negotia
Jamie 2013/07/18 22:44:56 I think it makes sense because the focus of the te
+ // asynchronous conditions, use this method to disable this feature and call
+ // RunCallback as appropriate.
+ void set_run_save_callback_automatically(
+ bool run_save_callback_automatically) {
+ run_save_callback_automatically_ = run_save_callback_automatically;
+ }
+
+ bool HasCallback() {
+ return !load_callback_.is_null() || !save_callback_.is_null();
Lambros 2013/07/18 20:34:51 nit: Move to .cc file? I think clang might trigger
Jamie 2013/07/18 22:44:56 I've made it const, but I think this is simple eno
+ }
+
+ // Run either the save or the load callback (whichever was set most recently;
+ // it is an error for both of these to be set at the same time).
void RunCallback();
private:
+ void SetPairingsJsonAndRunCallback(
+ const std::string& pairings_json,
+ const PairingRegistry::SaveCallback& callback);
+
base::Closure load_callback_;
+ base::Closure save_callback_;
std::string pairings_json_;
+ bool run_save_callback_automatically_;
};
} // namespace protocol

Powered by Google App Engine
This is Rietveld 408576698