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

Side by Side Diff: mojo/apps/js/test/run_apps_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: Fixed WebUIMojoTest.EndToEndPing Created 6 years, 4 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
« no previous file with comments | « mojo/apps/js/test/js_to_cpp_unittest.js ('k') | mojo/bindings/js/codec_unittests.js » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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"
6 #include "base/files/file_path.h" 5 #include "base/files/file_path.h"
7 #include "base/path_service.h" 6 #include "base/path_service.h"
8 #include "gin/modules/console.h" 7 #include "gin/modules/console.h"
9 #include "gin/modules/module_registry.h" 8 #include "gin/modules/module_registry.h"
10 #include "gin/modules/timer.h" 9 #include "gin/modules/timer.h"
11 #include "gin/test/file_runner.h" 10 #include "gin/test/file_runner.h"
12 #include "gin/test/gtest.h" 11 #include "gin/test/gtest.h"
13 #include "mojo/apps/js/bindings/monotonic_clock.h" 12 #include "mojo/apps/js/bindings/monotonic_clock.h"
14 #include "mojo/apps/js/bindings/threading.h" 13 #include "mojo/apps/js/bindings/threading.h"
15 #include "mojo/bindings/js/core.h" 14 #include "mojo/bindings/js/core.h"
16 #include "mojo/common/test/test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
18 16
19 namespace mojo { 17 namespace mojo {
20 namespace js { 18 namespace js {
21 namespace { 19 namespace {
22 20
23 class TestRunnerDelegate : public gin::FileRunnerDelegate { 21 class TestRunnerDelegate : public gin::FileRunnerDelegate {
24 public: 22 public:
25 TestRunnerDelegate() { 23 TestRunnerDelegate() {
26 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
(...skipping 16 matching lines...) Expand all
43 .AppendASCII("js") 41 .AppendASCII("js")
44 .AppendASCII("bindings") 42 .AppendASCII("bindings")
45 .AppendASCII(test); 43 .AppendASCII(test);
46 TestRunnerDelegate delegate; 44 TestRunnerDelegate delegate;
47 gin::RunTestFromFile(path, &delegate, run_until_idle); 45 gin::RunTestFromFile(path, &delegate, run_until_idle);
48 } 46 }
49 47
50 // TODO(abarth): Should we autogenerate these stubs from GYP? 48 // TODO(abarth): Should we autogenerate these stubs from GYP?
51 49
52 TEST(JSTest, sample_test) { 50 TEST(JSTest, sample_test) {
53 // TODO(yzshen): Remove this check once isolated tests are supported on the
54 // Chromium waterfall. (http://crbug.com/351214)
55 const base::FilePath test_file_path(
56 test::GetFilePathForJSResource(
57 "mojo/public/interfaces/bindings/tests/sample_service.mojom"));
58 if (!base::PathExists(test_file_path)) {
59 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
60 return;
61 }
62
63 RunTest("sample_service_unittests.js", true); 51 RunTest("sample_service_unittests.js", true);
64 } 52 }
65 53
66 TEST(JSTest, connection) { 54 TEST(JSTest, connection) {
67 // TODO(yzshen): Remove this check once isolated tests are supported on the
68 // Chromium waterfall. (http://crbug.com/351214)
69 const base::FilePath test_file_path(
70 test::GetFilePathForJSResource(
71 "mojo/public/interfaces/bindings/tests/sample_service.mojom"));
72 if (!base::PathExists(test_file_path)) {
73 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
74 return;
75 }
76
77 RunTest("connection_unittests.js", false); 55 RunTest("connection_unittests.js", false);
78 } 56 }
79 57
80 TEST(JSTest, monotonic_clock) { 58 TEST(JSTest, monotonic_clock) {
81 RunTest("monotonic_clock_unittests.js", false); 59 RunTest("monotonic_clock_unittests.js", false);
82 } 60 }
83 61
84 } // namespace 62 } // namespace
85 } // namespace js 63 } // namespace js
86 } // namespace mojo 64 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/apps/js/test/js_to_cpp_unittest.js ('k') | mojo/bindings/js/codec_unittests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698