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

Side by Side Diff: mojo/apps/js/test/run_apps_js_tests.cc

Issue 253413004: Enable mojo js tests which depend on mojom.js files in gen/. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 6 years, 8 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 | « content/content_tests.gypi ('k') | mojo/bindings/js/run_js_tests.cc » ('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" 5 #include "base/file_util.h"
6 #include "base/files/file_path.h"
6 #include "base/path_service.h" 7 #include "base/path_service.h"
7 #include "build/build_config.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"
11 #include "gin/test/file_runner.h" 11 #include "gin/test/file_runner.h"
12 #include "gin/test/gtest.h" 12 #include "gin/test/gtest.h"
13 #include "mojo/apps/js/bindings/monotonic_clock.h" 13 #include "mojo/apps/js/bindings/monotonic_clock.h"
14 #include "mojo/apps/js/bindings/threading.h" 14 #include "mojo/apps/js/bindings/threading.h"
15 #include "mojo/bindings/js/core.h" 15 #include "mojo/bindings/js/core.h"
16 #include "mojo/bindings/js/unicode.h" 16 #include "mojo/bindings/js/unicode.h"
17 #include "mojo/common/test/test_utils.h"
17 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
18 19
19 namespace mojo { 20 namespace mojo {
20 namespace js { 21 namespace js {
21 namespace { 22 namespace {
22 23
23 class TestRunnerDelegate : public gin::FileRunnerDelegate { 24 class TestRunnerDelegate : public gin::FileRunnerDelegate {
24 public: 25 public:
25 TestRunnerDelegate() { 26 TestRunnerDelegate() {
26 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 27 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
(...skipping 16 matching lines...) Expand all
43 .AppendASCII("apps") 44 .AppendASCII("apps")
44 .AppendASCII("js") 45 .AppendASCII("js")
45 .AppendASCII("bindings") 46 .AppendASCII("bindings")
46 .AppendASCII(test); 47 .AppendASCII(test);
47 TestRunnerDelegate delegate; 48 TestRunnerDelegate delegate;
48 gin::RunTestFromFile(path, &delegate, run_until_idle); 49 gin::RunTestFromFile(path, &delegate, run_until_idle);
49 } 50 }
50 51
51 // TODO(abarth): Should we autogenerate these stubs from GYP? 52 // TODO(abarth): Should we autogenerate these stubs from GYP?
52 53
53 // http://crbug.com/351214 54 TEST(JSTest, sample_test) {
54 #if defined(OS_POSIX) 55 // TODO(yzshen): Remove this check once isolated tests are supported on the
55 #define MAYBE_sample_test DISABLED_sample_test 56 // Chromium waterfall. (http://crbug.com/351214)
56 #else 57 const base::FilePath test_file_path(
57 #define MAYBE_sample_test sample_test 58 test::GetFilePathForJSResource(
58 #endif 59 "mojo/public/interfaces/bindings/tests/sample_service.mojom"));
59 TEST(JSTest, MAYBE_sample_test) { 60 if (!base::PathExists(test_file_path)) {
61 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
62 return;
63 }
64
60 RunTest("sample_service_unittests.js", true); 65 RunTest("sample_service_unittests.js", true);
61 } 66 }
62 67
63 // http://crbug.com/351214 68 TEST(JSTest, connection) {
64 #if defined(OS_POSIX) 69 // TODO(yzshen): Remove this check once isolated tests are supported on the
65 #define MAYBE_connection DISABLED_connection 70 // Chromium waterfall. (http://crbug.com/351214)
66 #else 71 const base::FilePath test_file_path(
67 #define MAYBE_connection connection 72 test::GetFilePathForJSResource(
68 #endif 73 "mojo/public/interfaces/bindings/tests/sample_service.mojom"));
69 TEST(JSTest, MAYBE_connection) { 74 if (!base::PathExists(test_file_path)) {
75 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test.";
76 return;
77 }
78
70 RunTest("connection_unittests.js", false); 79 RunTest("connection_unittests.js", false);
71 } 80 }
72 81
73 TEST(JSTest, monotonic_clock) { 82 TEST(JSTest, monotonic_clock) {
74 RunTest("monotonic_clock_unittests.js", false); 83 RunTest("monotonic_clock_unittests.js", false);
75 } 84 }
76 85
77 } // namespace 86 } // namespace
78 } // namespace js 87 } // namespace js
79 } // namespace mojo 88 } // namespace mojo
OLDNEW
« no previous file with comments | « content/content_tests.gypi ('k') | mojo/bindings/js/run_js_tests.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698