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

Side by Side Diff: mojo/bindings/js/run_js_tests.cc

Issue 411553003: Validate incoming JS Message Headers: test message parser (Closed) 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/file_util.h" 5 #include "base/file_util.h"
6 #include "base/files/file_path.h" 6 #include "base/files/file_path.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "gin/modules/console.h" 8 #include "gin/modules/console.h"
9 #include "gin/modules/module_registry.h" 9 #include "gin/modules/module_registry.h"
10 #include "gin/modules/timer.h" 10 #include "gin/modules/timer.h"
(...skipping 27 matching lines...) Expand all
38 .AppendASCII(test); 38 .AppendASCII(test);
39 TestRunnerDelegate delegate; 39 TestRunnerDelegate delegate;
40 gin::RunTestFromFile(path, &delegate, run_until_idle); 40 gin::RunTestFromFile(path, &delegate, run_until_idle);
41 } 41 }
42 42
43 // TODO(abarth): Should we autogenerate these stubs from GYP? 43 // TODO(abarth): Should we autogenerate these stubs from GYP?
44 TEST(JSTest, core) { 44 TEST(JSTest, core) {
45 RunTest("core_unittests.js", true); 45 RunTest("core_unittests.js", true);
46 } 46 }
47 47
48 TEST(JSTest, codec) { 48 static bool MojoBindingFilesExist() {
49 // TODO(yzshen): Remove this check once isolated tests are supported on the 49 // TODO(yzshen): Remove this check once isolated tests are supported on the
50 // Chromium waterfall. (http://crbug.com/351214) 50 // Chromium waterfall. (http://crbug.com/351214)
51 const base::FilePath test_file_path( 51 const base::FilePath test_file_path(
52 test::GetFilePathForJSResource( 52 test::GetFilePathForJSResource(
53 "mojo/public/interfaces/bindings/tests/sample_service.mojom")); 53 "mojo/public/interfaces/bindings/tests/sample_service.mojom"));
54 if (!base::PathExists(test_file_path)) { 54 if (!base::PathExists(test_file_path)) {
55 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test."; 55 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
56 return false;
57 }
58 return true;
59 }
60
61 TEST(JSTest, codec) {
62 if (!MojoBindingFilesExist())
56 return; 63 return;
57 } 64 RunTest("codec_unittests.js", true);
65 }
58 66
59 RunTest("codec_unittests.js", true); 67 TEST(JSTest, validation) {
68 if (!MojoBindingFilesExist())
69 return;
70 RunTest("validation_unittests.js", true);
60 } 71 }
61 72
62 } // namespace 73 } // namespace
63 } // namespace js 74 } // namespace js
64 } // namespace mojo 75 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698