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

Side by Side Diff: mojo/edk/js/tests/run_js_unittests.cc

Issue 2645873003: Cleanup mojo-js tests. (Closed)
Patch Set: more deps fixes Created 3 years, 11 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
« no previous file with comments | « mojo/edk/js/tests/js_to_cpp_tests.cc ('k') | mojo/edk/js/tests/sample_service_tests.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 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/files/file_path.h" 5 #include "base/files/file_path.h"
6 #include "base/macros.h" 6 #include "base/macros.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"
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/edk/js/core.h" 12 #include "mojo/edk/js/core.h"
14 #include "mojo/edk/js/support.h" 13 #include "mojo/edk/js/support.h"
15 #include "mojo/edk/js/threading.h" 14 #include "mojo/edk/js/threading.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 edk { 18 namespace edk {
20 namespace js { 19 namespace js {
21 namespace { 20 namespace {
22 21
23 class TestRunnerDelegate : public gin::FileRunnerDelegate { 22 class TestRunnerDelegate : public gin::FileRunnerDelegate {
24 public: 23 public:
25 TestRunnerDelegate() { 24 TestRunnerDelegate() {
26 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 25 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
27 AddBuiltinModule(Core::kModuleName, Core::GetModule); 26 AddBuiltinModule(Core::kModuleName, Core::GetModule);
28 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
29 AddBuiltinModule(Threading::kModuleName, Threading::GetModule); 27 AddBuiltinModule(Threading::kModuleName, Threading::GetModule);
30 AddBuiltinModule(Support::kModuleName, Support::GetModule); 28 AddBuiltinModule(Support::kModuleName, Support::GetModule);
31 } 29 }
30
32 private: 31 private:
33 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); 32 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
34 }; 33 };
35 34
36 void RunTest(std::string test) { 35 void RunTest(std::string test, bool run_until_idle) {
37 base::FilePath path; 36 base::FilePath path;
38 PathService::Get(base::DIR_SOURCE_ROOT, &path); 37 PathService::Get(base::DIR_SOURCE_ROOT, &path);
39 path = path.AppendASCII("mojo") 38 path = path.AppendASCII("mojo")
40 .AppendASCII("edk") 39 .AppendASCII("public")
41 .AppendASCII("js") 40 .AppendASCII("js")
42 .AppendASCII("tests") 41 .AppendASCII("tests")
43 .AppendASCII(test); 42 .AppendASCII(test);
44 TestRunnerDelegate delegate; 43 TestRunnerDelegate delegate;
45 gin::RunTestFromFile(path, &delegate, false); 44 gin::RunTestFromFile(path, &delegate, run_until_idle);
45 }
46
47 // TODO(abarth): Should we autogenerate these stubs from GYP?
48 TEST(JSTest, Binding) {
49 RunTest("binding_unittest.js", false);
50 }
51
52 TEST(JSTest, Codec) {
53 RunTest("codec_unittest.js", true);
46 } 54 }
47 55
48 TEST(JSTest, Connection) { 56 TEST(JSTest, Connection) {
49 RunTest("connection_tests.js"); 57 RunTest("connection_unittest.js", false);
58 }
59
60 TEST(JSTest, Core) {
61 RunTest("core_unittest.js", true);
62 }
63
64 TEST(JSTest, InterfacePtr) {
65 RunTest("interface_ptr_unittest.js", false);
50 } 66 }
51 67
52 TEST(JSTest, SampleService) { 68 TEST(JSTest, SampleService) {
53 RunTest("sample_service_tests.js"); 69 RunTest("sample_service_unittest.js", false);
54 } 70 }
55 71
56 TEST(JSTest, InterfacePtr) { 72 TEST(JSTest, Struct) {
57 RunTest("interface_ptr_tests.js"); 73 RunTest("struct_unittest.js", true);
58 } 74 }
59 75
60 TEST(JSTest, Binding) { 76 TEST(JSTest, Union) {
61 RunTest("binding_tests.js"); 77 RunTest("union_unittest.js", true);
78 }
79
80 TEST(JSTest, Validation) {
81 RunTest("validation_unittest.js", true);
62 } 82 }
63 83
64 } // namespace 84 } // namespace
65 } // namespace js 85 } // namespace js
66 } // namespace edk 86 } // namespace edk
67 } // namespace mojo 87 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/edk/js/tests/js_to_cpp_tests.cc ('k') | mojo/edk/js/tests/sample_service_tests.js » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698