| OLD | NEW |
| 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/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/module_registry.h" | 7 #include "gin/modules/module_registry.h" |
| 8 #include "gin/test/file_runner.h" | 8 #include "gin/test/file_runner.h" |
| 9 #include "gin/test/gtest.h" | 9 #include "gin/test/gtest.h" |
| 10 #include "mojo/public/bindings/js/core.h" | 10 #include "mojo/apps/js/bindings/core.h" |
| 11 #include "testing/gtest/include/gtest/gtest.h" | 11 #include "testing/gtest/include/gtest/gtest.h" |
| 12 | 12 |
| 13 namespace mojo { | 13 namespace mojo { |
| 14 namespace js { | 14 namespace js { |
| 15 namespace { | 15 namespace { |
| 16 | 16 |
| 17 class TestRunnerDelegate : public gin::FileRunnerDelegate { | 17 class TestRunnerDelegate : public gin::FileRunnerDelegate { |
| 18 public: | 18 public: |
| 19 TestRunnerDelegate() { | 19 TestRunnerDelegate() { |
| 20 AddBuiltinModule(Core::kModuleName, Core::GetTemplate); | 20 AddBuiltinModule(Core::kModuleName, Core::GetTemplate); |
| 21 } | 21 } |
| 22 | 22 |
| 23 private: | 23 private: |
| 24 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); | 24 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 void RunTest(std::string test) { | 27 void RunTest(std::string test) { |
| 28 base::FilePath path; | 28 base::FilePath path; |
| 29 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 29 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
| 30 path = path.AppendASCII("mojo") | 30 path = path.AppendASCII("mojo") |
| 31 .AppendASCII("public") | 31 .AppendASCII("apps") |
| 32 .AppendASCII("js") |
| 32 .AppendASCII("bindings") | 33 .AppendASCII("bindings") |
| 33 .AppendASCII("js") | |
| 34 .AppendASCII(test); | 34 .AppendASCII(test); |
| 35 TestRunnerDelegate delegate; | 35 TestRunnerDelegate delegate; |
| 36 gin::RunTestFromFile(path, &delegate); | 36 gin::RunTestFromFile(path, &delegate); |
| 37 } | 37 } |
| 38 | 38 |
| 39 // TODO(abarth): Should we autogenerate these stubs from GYP? | 39 // TODO(abarth): Should we autogenerate these stubs from GYP? |
| 40 TEST(JSTest, core) { | 40 TEST(JSTest, core) { |
| 41 RunTest("core_unittests.js"); | 41 RunTest("core_unittests.js"); |
| 42 } | 42 } |
| 43 | 43 |
| (...skipping 13 matching lines...) Expand all Loading... |
| 57 gin::RunTestFromFile(path, &delegate); | 57 gin::RunTestFromFile(path, &delegate); |
| 58 } | 58 } |
| 59 | 59 |
| 60 TEST(JSTest, connector) { | 60 TEST(JSTest, connector) { |
| 61 RunTest("connector_unittests.js"); | 61 RunTest("connector_unittests.js"); |
| 62 } | 62 } |
| 63 | 63 |
| 64 } // namespace | 64 } // namespace |
| 65 } // namespace js | 65 } // namespace js |
| 66 } // namespace mojo | 66 } // namespace mojo |
| OLD | NEW |