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

Unified Diff: chromecast/base/device_capabilities.h

Issue 1401993002: Refactoring DeviceCapabilities unit test. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Unregister() does not remove capability. Register() does not take initial value. Created 5 years, 2 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 | « no previous file | chromecast/base/device_capabilities_impl.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chromecast/base/device_capabilities.h
diff --git a/chromecast/base/device_capabilities.h b/chromecast/base/device_capabilities.h
index 2a3c2654c5e65cddd33f120246ba33e8638750ec..bffd37a0e6a60782dcfe8b8b690c2bc188428529 100644
--- a/chromecast/base/device_capabilities.h
+++ b/chromecast/base/device_capabilities.h
@@ -104,26 +104,30 @@ class DeviceCapabilities {
// Registers a Validator for a capability. A given key must only be
// registered once, and must be unregistered before calling Register() again.
- // The capability also gets added to the class with an initial value passed
- // in. If the capability has a value of Dictionary type, |key| must be just
+ // If the capability has a value of Dictionary type, |key| must be just
// the capability's top-level key and not include path expansions to levels
// farther down. For example, "foo" is a valid value for |key|, but "foo.bar"
// is not. Note that if "foo.bar" is updated in SetCapability(), the
// Validate() method for "foo"'s Validator will be called, with a |path| of
// "foo.bar". Both Register() and Unregister() must be called on cast
// receiver main thread; the Validator provided will also be called on cast
- // receiver main thread.
+ // receiver main thread. Note that this method does not add or modify
+ // the capability. To do this, SetCapability() should be called, or
+ // Validators can call SetValidatedValue().
virtual void Register(const std::string& key,
- scoped_ptr<base::Value> init_value,
Validator* validator) = 0;
- // Unregisters Validator for |key| and removes capability. |validator|
- // argument must match |validator| argument that was passed in to Register()
- // for |key|.
+ // Unregisters Validator for |key|. |validator| argument must match
+ // |validator| argument that was passed in to Register() for |key|. Note that
+ // the capability and its value remain untouched.
virtual void Unregister(const std::string& key,
const Validator* validator) = 0;
+ // Gets the Validator currently registered for |key|. Returns nullptr if
+ // no Validator is registered.
+ virtual Validator* GetValidator(const std::string& key) const = 0;
// Accessors for default capabilities. Note that the capability must be added
- // through Register() or SetCapability() before accessors are called.
+ // through SetCapability() or SetValidatedValue() (for Validators) before
+ // accessors are called.
virtual bool BluetoothSupported() const = 0;
virtual bool DisplaySupported() const = 0;
« no previous file with comments | « no previous file | chromecast/base/device_capabilities_impl.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698