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

Unified Diff: mojo/python/system/mojo/tests/validation_util.pyx

Issue 761553003: Add validation tests to python bindings. (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: Follow review Created 6 years, 1 month 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/python/system/mojo/tests/validation_util.pyx
diff --git a/mojo/python/system/mojo/tests/validation_util.pyx b/mojo/python/system/mojo/tests/validation_util.pyx
new file mode 100644
index 0000000000000000000000000000000000000000..e7bdbcdd5546650f42d931e0b79f54e1c0631ee6
--- /dev/null
+++ b/mojo/python/system/mojo/tests/validation_util.pyx
@@ -0,0 +1,35 @@
+# Copyright 2014 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.
+
+# distutils: language = c++
+
+from libc.stdint cimport uint8_t
+from libcpp cimport bool
+from libcpp.string cimport string
+from libcpp.vector cimport vector
+
+cdef extern from "third_party/cython/python_export.h":
+ pass
+
+cdef extern from "mojo/public/cpp/bindings/tests/validation_test_input_parser.h":
+ cdef bool ParseValidationTestInput "mojo::test::ParseValidationTestInput"(
+ string input,
+ vector[uint8_t]* data,
+ size_t* num_handles,
+ string* error_message)
+
+class Data(object):
+ def __init__(self, data, num_handles, error_message):
+ self.data = data
+ self.num_handles = num_handles
+ self.error_message = error_message
+
+def ParseData(value):
+ cdef string value_as_string = value
+ cdef vector[uint8_t] data_as_vector
+ cdef size_t num_handles
+ cdef string error_message
+ ParseValidationTestInput(
+ value, &data_as_vector, &num_handles, &error_message)
+ return Data(bytearray(data_as_vector), num_handles, error_message)
« no previous file with comments | « mojo/python/system/mojo/tests/__init__.py ('k') | mojo/python/tests/bindings_serialization_deserialization_unittest.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698