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

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

Issue 551293004: Mojo JS validation unit test should check Connection et al (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 6 years, 3 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
OLDNEW
1 // Copyright 2014 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/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/bindings/js/core.h" 12 #include "mojo/bindings/js/core.h"
13 #include "mojo/bindings/js/support.h"
14 #include "mojo/public/cpp/environment/environment.h"
13 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
14 16
15 namespace mojo { 17 namespace mojo {
16 namespace js { 18 namespace js {
17 namespace { 19 namespace {
18 20
19 class TestRunnerDelegate : public gin::FileRunnerDelegate { 21 class TestRunnerDelegate : public gin::FileRunnerDelegate {
20 public: 22 public:
21 TestRunnerDelegate() { 23 TestRunnerDelegate() {
22 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule); 24 AddBuiltinModule(gin::Console::kModuleName, gin::Console::GetModule);
23 AddBuiltinModule(Core::kModuleName, Core::GetModule); 25 AddBuiltinModule(Core::kModuleName, Core::GetModule);
26 AddBuiltinModule(Support::kModuleName, Support::GetModule);
24 } 27 }
25 28
26 private: 29 private:
27 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate); 30 DISALLOW_COPY_AND_ASSIGN(TestRunnerDelegate);
28 }; 31 };
29 32
30 void RunTest(std::string test, bool run_until_idle) { 33 void RunTest(std::string test, bool run_until_idle) {
34 Environment env;
31 base::FilePath path; 35 base::FilePath path;
32 PathService::Get(base::DIR_SOURCE_ROOT, &path); 36 PathService::Get(base::DIR_SOURCE_ROOT, &path);
33 path = path.AppendASCII("mojo") 37 path = path.AppendASCII("mojo")
34 .AppendASCII("public") 38 .AppendASCII("public")
35 .AppendASCII("js") 39 .AppendASCII("js")
36 .AppendASCII("bindings") 40 .AppendASCII("bindings")
37 .AppendASCII(test); 41 .AppendASCII(test);
38 TestRunnerDelegate delegate; 42 TestRunnerDelegate delegate;
39 gin::RunTestFromFile(path, &delegate, run_until_idle); 43 gin::RunTestFromFile(path, &delegate, run_until_idle);
40 } 44 }
41 45
42 // TODO(abarth): Should we autogenerate these stubs from GYP? 46 // TODO(abarth): Should we autogenerate these stubs from GYP?
43 TEST(JSTest, core) { 47 TEST(JSTest, core) {
44 RunTest("core_unittests.js", true); 48 RunTest("core_unittests.js", true);
45 } 49 }
46 50
47 TEST(JSTest, codec) { 51 TEST(JSTest, codec) {
48 RunTest("codec_unittests.js", true); 52 RunTest("codec_unittests.js", true);
49 } 53 }
50 54
51 TEST(JSTest, validation) { 55 TEST(JSTest, validation) {
52 RunTest("validation_unittests.js", true); 56 RunTest("validation_unittests.js", true);
53 } 57 }
54 58
55 } // namespace 59 } // namespace
56 } // namespace js 60 } // namespace js
57 } // namespace mojo 61 } // namespace mojo
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698