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/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" |
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/bindings/js/core.h" | 13 #include "mojo/bindings/js/core.h" |
14 #include "mojo/bindings/js/unicode.h" | |
15 #include "mojo/common/test/test_utils.h" | 14 #include "mojo/common/test/test_utils.h" |
16 #include "testing/gtest/include/gtest/gtest.h" | 15 #include "testing/gtest/include/gtest/gtest.h" |
17 | 16 |
18 namespace mojo { | 17 namespace mojo { |
19 namespace js { | 18 namespace js { |
20 namespace { | 19 namespace { |
21 | 20 |
22 class TestRunnerDelegate : public gin::FileRunnerDelegate { | 21 class TestRunnerDelegate : public gin::FileRunnerDelegate { |
23 public: | 22 public: |
24 TestRunnerDelegate() { | 23 TestRunnerDelegate() { |
25 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); | 24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); |
26 AddBuiltinModule(Core::kModuleName, Core::GetModule); | 25 AddBuiltinModule(Core::kModuleName, Core::GetModule); |
27 AddBuiltinModule(Unicode::kModuleName, Unicode::GetModule); | |
28 } | 26 } |
29 | 27 |
30 private: | 28 private: |
31 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); | 29 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); |
32 }; | 30 }; |
33 | 31 |
34 void RunTest(std::string test, bool run_until_idle) { | 32 void RunTest(std::string test, bool run_until_idle) { |
35 base::FilePath path; | 33 base::FilePath path; |
36 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 34 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
37 path = path.AppendASCII("mojo") | 35 path = path.AppendASCII("mojo") |
(...skipping 19 matching lines...) Expand all Loading... |
57 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test."; | 55 LOG(WARNING) << "Mojom binding files don't exist. Skipping the test."; |
58 return; | 56 return; |
59 } | 57 } |
60 | 58 |
61 RunTest("codec_unittests.js", true); | 59 RunTest("codec_unittests.js", true); |
62 } | 60 } |
63 | 61 |
64 } // namespace | 62 } // namespace |
65 } // namespace js | 63 } // namespace js |
66 } // namespace mojo | 64 } // namespace mojo |
OLD | NEW |