| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/files/file_path.h" | |
| 6 #include "base/path_service.h" | |
| 7 #include "gin/modules/console.h" | |
| 8 #include "gin/modules/module_registry.h" | |
| 9 #include "gin/modules/timer.h" | |
| 10 #include "gin/test/file_runner.h" | |
| 11 #include "gin/test/gtest.h" | |
| 12 #include "mojo/apps/js/bindings/monotonic_clock.h" | |
| 13 #include "mojo/edk/js/core.h" | |
| 14 #include "testing/gtest/include/gtest/gtest.h" | |
| 15 | |
| 16 namespace mojo { | |
| 17 namespace js { | |
| 18 namespace { | |
| 19 | |
| 20 class TestRunnerDelegate : public gin::FileRunnerDelegate { | |
| 21 public: | |
| 22 TestRunnerDelegate() { | |
| 23 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); | |
| 24 AddBuiltinModule(Core::kModuleName, Core::GetModule); | |
| 25 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule); | |
| 26 AddBuiltinModule(apps::MonotonicClock::kModuleName, | |
| 27 apps::MonotonicClock::GetModule); | |
| 28 } | |
| 29 | |
| 30 private: | |
| 31 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); | |
| 32 }; | |
| 33 | |
| 34 void RunTest(std::string test, bool run_until_idle) { | |
| 35 base::FilePath path; | |
| 36 PathService::Get(base::DIR_SOURCE_ROOT, &path); | |
| 37 path = path.AppendASCII("mojo") | |
| 38 .AppendASCII("apps") | |
| 39 .AppendASCII("js") | |
| 40 .AppendASCII("bindings") | |
| 41 .AppendASCII(test); | |
| 42 TestRunnerDelegate delegate; | |
| 43 gin::RunTestFromFile(path, &delegate, run_until_idle); | |
| 44 } | |
| 45 | |
| 46 // TODO(abarth): Should we autogenerate these stubs from GYP? | |
| 47 | |
| 48 TEST(JSTest, monotonic_clock) { | |
| 49 RunTest("monotonic_clock_unittests.js", false); | |
| 50 } | |
| 51 | |
| 52 } // namespace | |
| 53 } // namespace js | |
| 54 } // namespace mojo | |
| OLD | NEW |