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

Unified Diff: mojo/public/cpp/bindings/tests/validation_test_input_parser.cc

Issue 340553002: Mojo validation test input parser: disallow multiple [anchr]s with the same ID. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 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 | mojo/public/cpp/bindings/tests/validation_unittest.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
diff --git a/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc b/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
index 49544ee61215b6ec0278d7eb7e3eff3afaa2b65b..f5a5962d9f87510b5e5db3758685f7c4f8b41ab1 100644
--- a/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
+++ b/mojo/public/cpp/bindings/tests/validation_test_input_parser.cc
@@ -10,6 +10,7 @@
#include <limits>
#include <map>
+#include <set>
#include <utility>
#include "mojo/public/c/system/macros.h"
@@ -112,6 +113,7 @@ class ValidationTestInputParser {
std::string* error_message_;
std::map<std::string, PendingDistanceItem> pending_distance_items_;
+ std::set<std::string> anchors_;
};
#define DATA_TYPE(name, data_size, parse_data_func) \
@@ -329,6 +331,10 @@ bool ValidationTestInputParser::ParseDistance(const DataType& type,
bool ValidationTestInputParser::ParseAnchor(const DataType& type,
const std::string& value_string) {
+ if (anchors_.find(value_string) != anchors_.end())
+ return false;
Tom Sepez 2014/06/17 17:38:33 do we want to set *error_message_ here?
yzshen1 2014/06/17 17:41:24 It will be the general error "Error occurred when
+ anchors_.insert(value_string);
+
std::map<std::string, PendingDistanceItem>::iterator iter =
pending_distance_items_.find(value_string);
if (iter == pending_distance_items_.end())
« no previous file with comments | « no previous file | mojo/public/cpp/bindings/tests/validation_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698