buffet: load standard GCD command definitions in CommandManager Changed CommandManager to load the base command definitions and use it as a base schema for loading device-specific commands and make sure device vendors are not redefining standard commands in breaking manner. BUG=chromium:374861 TEST=USE=buffet P2_TEST_FILTER="buffet::*" FEATURES=test emerge-link platform2 Change-Id: I5f2d5500bc90ef918a8a6df1242bdd1fe3b78615 Reviewed-on: https://chromium-review.googlesource.com/209175 Tested-by: Alex Vakulenko <avakulenko@chromium.org> Reviewed-by: Christopher Wiley <wiley@chromium.org> Commit-Queue: Alex Vakulenko <avakulenko@chromium.org>
diff --git a/buffet/commands/command_dictionary.h b/buffet/commands/command_dictionary.h index 11295c9..78f2cee 100644 --- a/buffet/commands/command_dictionary.h +++ b/buffet/commands/command_dictionary.h
@@ -46,10 +46,14 @@ // When LoadCommands is called, all previous definitions of commands from the // same category are removed, effectively replacing all the commands in the // given category. + // Optional |base_commands| parameter specifies the definition of standard + // GCD commands for parameter schema validation. Can be set to nullptr if + // no validation is needed. // Returns false on failure and |error| provides additional error information // when provided. bool LoadCommands(const base::DictionaryValue& json, - const std::string& category, ErrorPtr* error); + const std::string& category, + const CommandDictionary* base_commands, ErrorPtr* error); // Returns the number of command definitions in the dictionary. size_t GetSize() const { return definitions_.size(); } // Checks if the dictionary has no command definitions.