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 "gin/test/file_runner.h" | 5 #include "gin/test/file_runner.h" |
6 | 6 |
7 #include "base/file_util.h" | 7 #include "base/file_util.h" |
8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
9 #include "base/path_service.h" | 9 #include "base/path_service.h" |
10 #include "gin/converter.h" | 10 #include "gin/converter.h" |
11 #include "gin/gin.h" | 11 #include "gin/gin.h" |
| 12 #include "gin/modules/console.h" |
12 #include "gin/modules/module_registry.h" | 13 #include "gin/modules/module_registry.h" |
13 #include "gin/test/gtest.h" | 14 #include "gin/test/gtest.h" |
14 #include "gin/try_catch.h" | 15 #include "gin/try_catch.h" |
15 #include "testing/gtest/include/gtest/gtest.h" | 16 #include "testing/gtest/include/gtest/gtest.h" |
16 | 17 |
17 namespace gin { | 18 namespace gin { |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 base::FilePath GetModuleBase() { | 22 base::FilePath GetModuleBase() { |
22 base::FilePath path; | 23 base::FilePath path; |
23 PathService::Get(base::DIR_SOURCE_ROOT, &path); | 24 PathService::Get(base::DIR_SOURCE_ROOT, &path); |
24 return path; | 25 return path; |
25 } | 26 } |
26 | 27 |
27 } // namespace | 28 } // namespace |
28 | 29 |
29 FileRunnerDelegate::FileRunnerDelegate() | 30 FileRunnerDelegate::FileRunnerDelegate() |
30 : ModuleRunnerDelegate(GetModuleBase()) { | 31 : ModuleRunnerDelegate(GetModuleBase()) { |
| 32 AddBuiltinModule(Console::kModuleName, Console::GetTemplate); |
31 AddBuiltinModule(GTest::kModuleName, GTest::GetTemplate); | 33 AddBuiltinModule(GTest::kModuleName, GTest::GetTemplate); |
32 } | 34 } |
33 | 35 |
34 FileRunnerDelegate::~FileRunnerDelegate() { | 36 FileRunnerDelegate::~FileRunnerDelegate() { |
35 } | 37 } |
36 | 38 |
37 void FileRunnerDelegate::UnhandledException(Runner* runner, | 39 void FileRunnerDelegate::UnhandledException(Runner* runner, |
38 TryCatch& try_catch) { | 40 TryCatch& try_catch) { |
39 ModuleRunnerDelegate::UnhandledException(runner, try_catch); | 41 ModuleRunnerDelegate::UnhandledException(runner, try_catch); |
40 EXPECT_FALSE(try_catch.HasCaught()) << try_catch.GetPrettyMessage(); | 42 EXPECT_FALSE(try_catch.HasCaught()) << try_catch.GetPrettyMessage(); |
(...skipping 16 matching lines...) Expand all Loading... |
57 | 59 |
58 v8::Handle<v8::Value> result = runner.context()->Global()->Get( | 60 v8::Handle<v8::Value> result = runner.context()->Global()->Get( |
59 StringToSymbol(runner.isolate(), "result")); | 61 StringToSymbol(runner.isolate(), "result")); |
60 std::string result_string; | 62 std::string result_string; |
61 ASSERT_TRUE(ConvertFromV8(result, &result_string)); | 63 ASSERT_TRUE(ConvertFromV8(result, &result_string)); |
62 EXPECT_EQ("PASS", result_string); | 64 EXPECT_EQ("PASS", result_string); |
63 } | 65 } |
64 } | 66 } |
65 | 67 |
66 } // namespace gin | 68 } // namespace gin |
OLD | NEW |