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

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

Issue 62333018: Implement Asynchronous Module Definition API for Mojo (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Moar testing Created 7 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 | Annotate | Revision Log
OLDNEW
(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/file_util.h"
6 #include "base/path_service.h"
7 #include "gin/modules/module_registry.h"
8 #include "gin/test/file_runner.h"
9 #include "gin/test/gtest.h"
10 #include "mojo/public/bindings/js/runner_delegate.h"
11 #include "testing/gtest/include/gtest/gtest.h"
12
13 namespace mojo {
14 namespace js {
15 namespace {
16
17 class TestRunnerDelegate : public RunnerDelegate {
18 virtual void DidCreateContext(gin::Runner* runner) MOJO_OVERRIDE {
19 RunnerDelegate::DidCreateContext(runner);
20
21 v8::Handle<v8::Context> context = runner->context();
22 gin::ModuleRegistry* registry =
23 gin::ModuleRegistry::From(context);
24
25 registry->AddBuiltinModule(runner->isolate(), "gtest",
26 gin::GetGTestTemplate(runner->isolate()));
27 }
28 };
29
30 void RunTest(std::string test) {
31 base::FilePath path;
32 PathService::Get(base::DIR_SOURCE_ROOT, &path);
33 path = path.AppendASCII("mojo")
34 .AppendASCII("public")
35 .AppendASCII("bindings")
36 .AppendASCII("js")
37 .AppendASCII(test);
38 TestRunnerDelegate delegate;
39 gin::RunTestFromFile(path, &delegate);
40 }
41
42 // TODO(abarth): Should we autogenerate these stubs from GYP?
43 TEST(JSTest, core) {
44 RunTest("core_unittests.js");
45 }
46
47 } // namespace
48 } // namespace js
49 } // namespace mojo
OLDNEW
« gin/modules/module_registry.cc ('K') | « mojo/public/bindings/js/test/harness.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698