| OLD | NEW |
| (Empty) |
| 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 | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/files/file_path.h" | |
| 6 #include "base/macros.h" | |
| 7 #include "base/path_service.h" | |
| 8 #include "gin/modules/console.h" | |
| 9 #include "gin/modules/module_registry.h" | |
| 10 #include "gin/modules/timer.h" | |
| 11 #include "gin/test/file_runner.h" | |
| 12 #include "gin/test/gtest.h" | |
| 13 #include "mojo/edk/js/core.h" | |
| 14 #include "mojo/edk/js/support.h" | |
| 15 #include "mojo/edk/js/threading.h" | |
| 16 #include "testing/gtest/include/gtest/gtest.h" | |
| 17 | |
| 18 namespace mojo { | |
| 19 namespace edk { | |
| 20 namespace js { | |
| 21 namespace { | |
| 22 | |
| 23 class TestRunnerDelegate : public gin::FileRunnerDelegate { | |
| 24 public: | |
| 25 TestRunnerDelegate() { | |
| 26 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); | |
| 27 AddBuiltinModule(Core::kModuleName, Core::GetModule); | |
| 28 AddBuiltinModule(gin::TimerModule::kName, gin::TimerModule::GetModule); | |
| 29 AddBuiltinModule(Threading::kModuleName, Threading::GetModule); | |
| 30 AddBuiltinModule(Support::kModuleName, Support::GetModule); | |
| 31 } | |
| 32 private: | |
| 33 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); | |
| 34 }; | |
| 35 | |
| 36 void RunTest(std::string test) { | |
| 37 base::FilePath path; | |
| 38 PathService::Get(base::DIR_SOURCE_ROOT, &path); | |
| 39 path = path.AppendASCII("mojo") | |
| 40 .AppendASCII("edk") | |
| 41 .AppendASCII("js") | |
| 42 .AppendASCII("tests") | |
| 43 .AppendASCII(test); | |
| 44 TestRunnerDelegate delegate; | |
| 45 gin::RunTestFromFile(path, &delegate, false); | |
| 46 } | |
| 47 | |
| 48 TEST(JSTest, Connection) { | |
| 49 RunTest("connection_tests.js"); | |
| 50 } | |
| 51 | |
| 52 TEST(JSTest, SampleService) { | |
| 53 RunTest("sample_service_tests.js"); | |
| 54 } | |
| 55 | |
| 56 TEST(JSTest, InterfacePtr) { | |
| 57 RunTest("interface_ptr_tests.js"); | |
| 58 } | |
| 59 | |
| 60 TEST(JSTest, Binding) { | |
| 61 RunTest("binding_tests.js"); | |
| 62 } | |
| 63 | |
| 64 } // namespace | |
| 65 } // namespace js | |
| 66 } // namespace edk | |
| 67 } // namespace mojo | |
| OLD | NEW |