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

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: Restored parser comment changes 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 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"
yzshen1 2014/07/23 19:53:38 It seems this one is still needed.
7 #include "base/path_service.h" 5 #include "base/path_service.h"
8 #include "gin/modules/console.h" 6 #include "gin/modules/console.h"
9 #include "gin/modules/module_registry.h" 7 #include "gin/modules/module_registry.h"
10 #include "gin/modules/timer.h" 8 #include "gin/modules/timer.h"
11 #include "gin/test/file_runner.h" 9 #include "gin/test/file_runner.h"
12 #include "gin/test/gtest.h" 10 #include "gin/test/gtest.h"
13 #include "mojo/apps/js/bindings/monotonic_clock.h" 11 #include "mojo/apps/js/bindings/monotonic_clock.h"
14 #include "mojo/apps/js/bindings/threading.h" 12 #include "mojo/apps/js/bindings/threading.h"
15 #include "mojo/bindings/js/core.h" 13 #include "mojo/bindings/js/core.h"
16 #include "mojo/common/test/test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
18 15
19 namespace mojo { 16 namespace mojo {
20 namespace js { 17 namespace js {
21 namespace { 18 namespace {
22 19
23 class TestRunnerDelegate : public gin::FileRunnerDelegate { 20 class TestRunnerDelegate : public gin::FileRunnerDelegate {
24 public: 21 public:
25 TestRunnerDelegate() { 22 TestRunnerDelegate() {
26 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 23 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
(...skipping 16 matching lines...) Expand all
43 .AppendASCII("js") 40 .AppendASCII("js")
44 .AppendASCII("bindings") 41 .AppendASCII("bindings")
45 .AppendASCII(test); 42 .AppendASCII(test);
46 TestRunnerDelegate delegate; 43 TestRunnerDelegate delegate;
47 gin::RunTestFromFile(path, &delegate, run_until_idle); 44 gin::RunTestFromFile(path, &delegate, run_until_idle);
48 } 45 }
49 46
50 // TODO(abarth): Should we autogenerate these stubs from GYP? 47 // TODO(abarth): Should we autogenerate these stubs from GYP?
51 48
52 TEST(JSTest, sample_test) { 49 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); 50 RunTest("sample_service_unittests.js", true);
64 } 51 }
65 52
66 TEST(JSTest, connection) { 53 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); 54 RunTest("connection_unittests.js", false);
78 } 55 }
79 56
80 TEST(JSTest, monotonic_clock) { 57 TEST(JSTest, monotonic_clock) {
81 RunTest("monotonic_clock_unittests.js", false); 58 RunTest("monotonic_clock_unittests.js", false);
82 } 59 }
83 60
84 } // namespace 61 } // namespace
85 } // namespace js 62 } // namespace js
86 } // namespace mojo 63 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698