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

Unified Diff: mojo/bindings/js/run_js_tests.cc

Issue 406993002: Validate incoming JS Message Headers Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 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/bindings/js/run_js_tests.cc
diff --git a/mojo/bindings/js/run_js_tests.cc b/mojo/bindings/js/run_js_tests.cc
index 976a0b17591b90da5ba84d04ec2ad7d16f666d78..c67f1ad6333c3a2e6eb403bcdd4d2b2d3d4e2b03 100644
--- a/mojo/bindings/js/run_js_tests.cc
+++ b/mojo/bindings/js/run_js_tests.cc
@@ -11,6 +11,7 @@
#include "gin/test/file_runner.h"
#include "gin/test/gtest.h"
#include "mojo/bindings/js/core.h"
+#include "mojo/bindings/js/file_io.h"
#include "mojo/common/test/test_utils.h"
#include "testing/gtest/include/gtest/gtest.h"
@@ -22,6 +23,7 @@ class TestRunnerDelegate : public gin::FileRunnerDelegate {
public:
TestRunnerDelegate() {
AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
+ AddBuiltinModule(FileIO::kModuleName, FileIO::GetModule);
AddBuiltinModule(Core::kModuleName, Core::GetModule);
}
@@ -45,7 +47,7 @@ TEST(JSTest, core) {
RunTest("core_unittests.js", true);
}
-TEST(JSTest, codec) {
+static bool MojoBindingFilesExist() {
// TODO(yzshen): Remove this check once isolated tests are supported on the
// Chromium waterfall. (http://crbug.com/351214)
const base::FilePath test_file_path(
@@ -53,12 +55,23 @@ TEST(JSTest, codec) {
"mojo/public/interfaces/bindings/tests/sample_service.mojom"));
if (!base::PathExists(test_file_path)) {
LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
- return;
+ return false;
}
+ return true;
+}
+TEST(JSTest, codec) {
+ if (!MojoBindingFilesExist())
+ return;
RunTest("codec_unittests.js", true);
}
+TEST(JSTest, validation) {
+ if (!MojoBindingFilesExist())
+ return;
+ RunTest("validation_unittests.js", true);
+}
+
} // namespace
} // namespace js
} // namespace mojo

Powered by Google App Engine
This is Rietveld 408576698