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

Unified Diff: mojo/public/cpp/bindings/tests/validation_util.h

Issue 2163793002: C bindings: Implement _Validate(), and some pre-requisites (Closed) Base URL: git@github.com:domokit/mojo.git@master
Patch Set: share common validation utility code between c/c++ tests. remove generating __HasResponse for inte… Created 4 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: mojo/public/cpp/bindings/tests/validation_util.h
diff --git a/mojo/public/cpp/bindings/tests/validation_util.h b/mojo/public/cpp/bindings/tests/validation_util.h
new file mode 100644
index 0000000000000000000000000000000000000000..e02b437ead11ba8c80e85bd97eb319bba6e37346
--- /dev/null
+++ b/mojo/public/cpp/bindings/tests/validation_util.h
@@ -0,0 +1,38 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+// This file contains utility functions for reading and parsing validation data
+// files.
+
+#ifndef MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_UTIL_H_
+#define MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_UTIL_H_
+
+#include <stddef.h>
+#include <stdint.h>
+
+#include <string>
+#include <vector>
+
+namespace mojo {
+namespace test {
+namespace validation_util {
+
+// Given |test_name|, which is the filename of a test file (excluding the
+// extension), reads in and parses the binary test data (stored in |data|), the
+// number of expected handles (stored in |num_handles|), and the expected
+// validation string (stored in |expected|).
+bool ReadTestCase(const std::string& test_name,
+ std::vector<uint8_t>* data,
+ size_t* num_handles,
+ std::string* expected);
+
+// Gets a list of matching tests with prefix |prefix|; these list of tests are
+// file names of the tests, without the '.data' extension.
+std::vector<std::string> GetMatchingTests(const std::string& prefix);
+
+} // namespace mojo
viettrungluu 2016/07/28 23:03:01 The order of these "// namespace ..." comments is
vardhan 2016/07/29 21:29:22 oops, thanks!
+} // namespace test
+} // namespace validation_util
+
+#endif // MOJO_PUBLIC_CPP_BINDINGS_TESTS_VALIDATION_UTIL_H_

Powered by Google App Engine
This is Rietveld 408576698