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

Side by Side Diff: mojo/apps/js/test/run_apps_js_tests.cc

Issue 709603002: Move mojo/apps/js tests et al to mojo/edk/js/test,tests (Closed) Base URL: https://github.com/domokit/mojo.git@master
Patch Set: chromium environment for JS tests Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/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" 12 #include "mojo/apps/js/bindings/monotonic_clock.h"
13 #include "mojo/apps/js/bindings/threading.h"
14 #include "mojo/edk/js/core.h" 13 #include "mojo/edk/js/core.h"
15 #include "testing/gtest/include/gtest/gtest.h" 14 #include "testing/gtest/include/gtest/gtest.h"
16 15
17 namespace mojo { 16 namespace mojo {
18 namespace js { 17 namespace js {
19 namespace { 18 namespace {
20 19
21 class TestRunnerDelegate : public gin::FileRunnerDelegate { 20 class TestRunnerDelegate : public gin::FileRunnerDelegate {
22 public: 21 public:
23 TestRunnerDelegate() { 22 TestRunnerDelegate() {
24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 23 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
25 AddBuiltinModule(Core::kModuleName, Core::GetModule); 24 AddBuiltinModule(Core::kModuleName, Core::GetModule);
26 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule); 25 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule);
27 AddBuiltinModule(apps::MonotonicClock::kModuleName, 26 AddBuiltinModule(apps::MonotonicClock::kModuleName,
28 apps::MonotonicClock::GetModule); 27 apps::MonotonicClock::GetModule);
29 AddBuiltinModule(apps::Threading::kModuleName, apps::Threading::GetModule);
30 } 28 }
31 29
32 private: 30 private:
33 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); 31 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
34 }; 32 };
35 33
36 void RunTest(std::string test, bool run_until_idle) { 34 void RunTest(std::string test, bool run_until_idle) {
37 base::FilePath path; 35 base::FilePath path;
38 PathService::Get(base::DIR_SOURCE_ROOT, &path); 36 PathService::Get(base::DIR_SOURCE_ROOT, &path);
39 path = path.AppendASCII("mojo") 37 path = path.AppendASCII("mojo")
40 .AppendASCII("apps") 38 .AppendASCII("apps")
41 .AppendASCII("js") 39 .AppendASCII("js")
42 .AppendASCII("bindings") 40 .AppendASCII("bindings")
43 .AppendASCII(test); 41 .AppendASCII(test);
44 TestRunnerDelegate delegate; 42 TestRunnerDelegate delegate;
45 gin::RunTestFromFile(path, &delegate, run_until_idle); 43 gin::RunTestFromFile(path, &delegate, run_until_idle);
46 } 44 }
47 45
48 // TODO(abarth): Should we autogenerate these stubs from GYP? 46 // TODO(abarth): Should we autogenerate these stubs from GYP?
49 47
50 TEST(JSTest, sample_test) {
51 RunTest("sample_service_unittests.js", true);
52 }
53
54 TEST(JSTest, connection) {
55 RunTest("connection_unittests.js", false);
56 }
57
58 TEST(JSTest, monotonic_clock) { 48 TEST(JSTest, monotonic_clock) {
59 RunTest("monotonic_clock_unittests.js", false); 49 RunTest("monotonic_clock_unittests.js", false);
60 } 50 }
61 51
62 } // namespace 52 } // namespace
63 } // namespace js 53 } // namespace js
64 } // namespace mojo 54 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698