OLD | NEW |
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/path_service.h" | 7 #include "base/path_service.h" |
7 #include "gin/modules/console.h" | 8 #include "gin/modules/console.h" |
8 #include "gin/modules/module_registry.h" | 9 #include "gin/modules/module_registry.h" |
9 #include "gin/modules/timer.h" | 10 #include "gin/modules/timer.h" |
10 #include "gin/test/file_runner.h" | 11 #include "gin/test/file_runner.h" |
11 #include "gin/test/gtest.h" | 12 #include "gin/test/gtest.h" |
12 #include "mojo/bindings/js/core.h" | 13 #include "mojo/bindings/js/core.h" |
13 #include "mojo/bindings/js/unicode.h" | 14 #include "mojo/bindings/js/unicode.h" |
| 15 #include "mojo/common/test/test_utils.h" |
14 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
15 | 17 |
16 namespace mojo { | 18 namespace mojo { |
17 namespace js { | 19 namespace js { |
18 namespace { | 20 namespace { |
19 | 21 |
20 class TestRunnerDelegate : public gin::FileRunnerDelegate { | 22 class TestRunnerDelegate : public gin::FileRunnerDelegate { |
21 public: | 23 public: |
22 TestRunnerDelegate() { | 24 TestRunnerDelegate() { |
23 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); | 25 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); |
(...skipping 14 matching lines...) Expand all Loading... |
38 .AppendASCII(test); | 40 .AppendASCII(test); |
39 TestRunnerDelegate delegate; | 41 TestRunnerDelegate delegate; |
40 gin::RunTestFromFile(path, &delegate, run_until_idle); | 42 gin::RunTestFromFile(path, &delegate, run_until_idle); |
41 } | 43 } |
42 | 44 |
43 // TODO(abarth): Should we autogenerate these stubs from GYP? | 45 // TODO(abarth): Should we autogenerate these stubs from GYP? |
44 TEST(JSTest, core) { | 46 TEST(JSTest, core) { |
45 RunTest("core_unittests.js", true); | 47 RunTest("core_unittests.js", true); |
46 } | 48 } |
47 | 49 |
48 // http://crbug.com/351214 | 50 TEST(JSTest, codec) { |
49 #if defined(OS_POSIX) | 51 // TODO(yzshen): Remove this check once isolated tests are supported on the |
50 #define MAYBE_codec DISABLED_codec | 52 // Chromium waterfall. (http://crbug.com/351214) |
51 #else | 53 const base::FilePath test_file_path( |
52 #define MAYBE_codec codec | 54 test::GetFilePathForJSResource( |
53 #endif | 55 "mojo/public/interfaces/bindings/tests/sample_service.mojom")); |
54 TEST(JSTest, MAYBE_codec) { | 56 if (!base::PathExists(test_file_path)) { |
| 57 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test."; |
| 58 return; |
| 59 } |
| 60 |
55 RunTest("codec_unittests.js", true); | 61 RunTest("codec_unittests.js", true); |
56 } | 62 } |
57 | 63 |
58 } // namespace | 64 } // namespace |
59 } // namespace js | 65 } // namespace js |
60 } // namespace mojo | 66 } // namespace mojo |
OLD | NEW |