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

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

Issue 2645873003: Cleanup mojo-js tests. (Closed)
Patch Set: fixes isolate_map 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
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/test/file_runner.h" 10 #include "gin/test/file_runner.h"
11 #include "gin/test/gtest.h" 11 #include "gin/test/gtest.h"
12 #include "mojo/edk/js/core.h" 12 #include "mojo/edk/js/core.h"
13 #include "mojo/edk/js/support.h" 13 #include "mojo/edk/js/support.h"
14 #include "mojo/edk/js/threading.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace mojo { 17 namespace mojo {
17 namespace edk { 18 namespace edk {
18 namespace js { 19 namespace js {
19 namespace { 20 namespace {
20 21
21 class TestRunnerDelegate : public gin::FileRunnerDelegate { 22 class TestRunnerDelegate : public gin::FileRunnerDelegate {
22 public: 23 public:
23 TestRunnerDelegate() { 24 TestRunnerDelegate() {
24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 25 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
25 AddBuiltinModule(Core::kModuleName, Core::GetModule); 26 AddBuiltinModule(Core::kModuleName, Core::GetModule);
27 AddBuiltinModule(Threading::kModuleName, Threading::GetModule);
26 AddBuiltinModule(Support::kModuleName, Support::GetModule); 28 AddBuiltinModule(Support::kModuleName, Support::GetModule);
27 } 29 }
28 30
29 private: 31 private:
30 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); 32 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
31 }; 33 };
32 34
33 void RunTest(std::string test, bool run_until_idle) { 35 void RunTest(std::string test, bool run_until_idle) {
34 base::FilePath path; 36 base::FilePath path;
35 PathService::Get(base::DIR_SOURCE_ROOT, &path); 37 PathService::Get(base::DIR_SOURCE_ROOT, &path);
36 path = path.AppendASCII("mojo") 38 path = path.AppendASCII("mojo")
37 .AppendASCII("public") 39 .AppendASCII("public")
38 .AppendASCII("js") 40 .AppendASCII("js")
39 .AppendASCII(test); 41 .AppendASCII(test);
40 TestRunnerDelegate delegate; 42 TestRunnerDelegate delegate;
41 gin::RunTestFromFile(path, &delegate, run_until_idle); 43 gin::RunTestFromFile(path, &delegate, run_until_idle);
42 } 44 }
43 45
44 // TODO(abarth): Should we autogenerate these stubs from GYP? 46 // TODO(abarth): Should we autogenerate these stubs from GYP?
45 TEST(JSTest, core) { 47 TEST(JSTest, core) {
yzshen1 2017/01/19 19:48:47 Now that you are here, please change the test name
alokp 2017/01/19 22:32:14 Done.
46 RunTest("core_unittests.js", true); 48 RunTest("core_unittests.js", true);
47 } 49 }
48 50
49 TEST(JSTest, codec) { 51 TEST(JSTest, codec) {
50 RunTest("codec_unittests.js", true); 52 RunTest("codec_unittests.js", true);
51 } 53 }
52 54
53 TEST(JSTest, struct) { 55 TEST(JSTest, struct) {
54 RunTest("struct_unittests.js", true); 56 RunTest("struct_unittests.js", true);
55 } 57 }
56 58
57 TEST(JSTest, union) { 59 TEST(JSTest, union) {
58 RunTest("union_unittests.js", true); 60 RunTest("union_unittests.js", true);
59 } 61 }
60 62
61 TEST(JSTest, validation) { 63 TEST(JSTest, validation) {
62 RunTest("validation_unittests.js", true); 64 RunTest("validation_unittests.js", true);
63 } 65 }
64 66
67 TEST(JSTest, Binding) {
68 RunTest("binding_tests.js", false);
69 }
70
71 TEST(JSTest, InterfacePtr) {
72 RunTest("interface_ptr_tests.js", false);
73 }
74
75 TEST(JSTest, Connection) {
76 RunTest("connection_tests.js", false);
77 }
78
79 TEST(JSTest, SampleService) {
80 RunTest("sample_service_tests.js", false);
81 }
82
65 } // namespace 83 } // namespace
66 } // namespace js 84 } // namespace js
67 } // namespace edk 85 } // namespace edk
68 } // namespace mojo 86 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698