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

Side by Side Diff: mojo/bindings/js/run_js_tests.cc

Issue 193403003: Move relevent JS tests to mojo_js_unittests (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: add back deps Created 6 years, 9 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 | « mojo/bindings/js/core_unittests.js ('k') | mojo/mojo.gyp » ('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 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/path_service.h" 6 #include "base/path_service.h"
7 #include "gin/modules/console.h" 7 #include "gin/modules/console.h"
8 #include "gin/modules/module_registry.h" 8 #include "gin/modules/module_registry.h"
9 #include "gin/modules/timer.h" 9 #include "gin/modules/timer.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/apps/js/bindings/monotonic_clock.h"
13 #include "mojo/apps/js/bindings/threading.h"
14 #include "mojo/bindings/js/core.h" 12 #include "mojo/bindings/js/core.h"
15 #include "testing/gtest/include/gtest/gtest.h" 13 #include "testing/gtest/include/gtest/gtest.h"
16 14
17 namespace mojo { 15 namespace mojo {
18 namespace js { 16 namespace js {
19 namespace { 17 namespace {
20 18
21 class TestRunnerDelegate : public gin::FileRunnerDelegate { 19 class TestRunnerDelegate : public gin::FileRunnerDelegate {
22 public: 20 public:
23 TestRunnerDelegate() { 21 TestRunnerDelegate() {
24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 22 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
25 AddBuiltinModule(Core::kModuleName, Core::GetModule); 23 AddBuiltinModule(Core::kModuleName, Core::GetModule);
26 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
27 AddBuiltinModule(apps::MonotonicClock::kModuleName,
28 apps::MonotonicClock::GetModule);
29 AddBuiltinModule(apps::Threading::kModuleName, apps::Threading::GetModule);
30 } 24 }
31 25
32 private: 26 private:
33 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); 27 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
34 }; 28 };
35 29
36 void RunTest(std::string test, bool run_until_idle) { 30 void RunTest(std::string test, bool run_until_idle) {
37 base::FilePath path; 31 base::FilePath path;
38 PathService::Get(base::DIR_SOURCE_ROOT, &path); 32 PathService::Get(base::DIR_SOURCE_ROOT, &path);
39 path = path.AppendASCII("mojo") 33 path = path.AppendASCII("mojo")
40 .AppendASCII("apps") 34 .AppendASCII("bindings")
41 .AppendASCII("js") 35 .AppendASCII("js")
42 .AppendASCII("bindings")
43 .AppendASCII(test); 36 .AppendASCII(test);
44 TestRunnerDelegate delegate; 37 TestRunnerDelegate delegate;
45 gin::RunTestFromFile(path, &delegate, run_until_idle); 38 gin::RunTestFromFile(path, &delegate, run_until_idle);
46 } 39 }
47 40
48 // TODO(abarth): Should we autogenerate these stubs from GYP? 41 // TODO(abarth): Should we autogenerate these stubs from GYP?
49 TEST(JSTest, core) { 42 TEST(JSTest, core) {
50 RunTest("core_unittests.js", true); 43 RunTest("core_unittests.js", true);
51 } 44 }
52 45
53 TEST(JSTest, codec) { 46 TEST(JSTest, codec) {
54 RunTest("codec_unittests.js", true); 47 RunTest("codec_unittests.js", true);
55 } 48 }
56 49
57 TEST(JSTest, sample_test) {
58 RunTest("sample_service_unittests.js", true);
59 }
60
61 TEST(JSTest, connector) {
62 RunTest("connector_unittests.js", true);
63 }
64
65 TEST(JSTest, monotonic_clock) {
66 RunTest("monotonic_clock_unittests.js", false);
67 }
68
69 } // namespace 50 } // namespace
70 } // namespace js 51 } // namespace js
71 } // namespace mojo 52 } // namespace mojo
OLDNEW
« no previous file with comments | « mojo/bindings/js/core_unittests.js ('k') | mojo/mojo.gyp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698