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/modules/console.h" | 11 #include "gin/modules/console.h" |
12 #include "gin/modules/module_registry.h" | 12 #include "gin/modules/module_registry.h" |
13 #include "gin/public/context_holder.h" | 13 #include "gin/public/context_holder.h" |
14 #include "gin/public/isolate_holder.h" | 14 #include "gin/public/isolate_holder.h" |
| 15 #include "gin/test/gc.h" |
15 #include "gin/test/gtest.h" | 16 #include "gin/test/gtest.h" |
16 #include "gin/try_catch.h" | 17 #include "gin/try_catch.h" |
17 #include "testing/gtest/include/gtest/gtest.h" | 18 #include "testing/gtest/include/gtest/gtest.h" |
18 | 19 |
19 namespace gin { | 20 namespace gin { |
20 | 21 |
21 namespace { | 22 namespace { |
22 | 23 |
23 std::vector<base::FilePath> GetModuleSearchPaths() { | 24 std::vector<base::FilePath> GetModuleSearchPaths() { |
24 std::vector<base::FilePath> search_paths(2); | 25 std::vector<base::FilePath> search_paths(2); |
25 PathService::Get(base::DIR_SOURCE_ROOT, &search_paths[0]); | 26 PathService::Get(base::DIR_SOURCE_ROOT, &search_paths[0]); |
26 PathService::Get(base::DIR_EXE, &search_paths[1]); | 27 PathService::Get(base::DIR_EXE, &search_paths[1]); |
27 search_paths[1] = search_paths[1].AppendASCII("gen"); | 28 search_paths[1] = search_paths[1].AppendASCII("gen"); |
28 return search_paths; | 29 return search_paths; |
29 } | 30 } |
30 | 31 |
31 } // namespace | 32 } // namespace |
32 | 33 |
33 FileRunnerDelegate::FileRunnerDelegate() | 34 FileRunnerDelegate::FileRunnerDelegate() |
34 : ModuleRunnerDelegate(GetModuleSearchPaths()) { | 35 : ModuleRunnerDelegate(GetModuleSearchPaths()) { |
35 AddBuiltinModule(Console::kModuleName, Console::GetModule); | 36 AddBuiltinModule(Console::kModuleName, Console::GetModule); |
36 AddBuiltinModule(GTest::kModuleName, GTest::GetModule); | 37 AddBuiltinModule(GTest::kModuleName, GTest::GetModule); |
| 38 AddBuiltinModule(GC::kModuleName, GC::GetModule); |
37 } | 39 } |
38 | 40 |
39 FileRunnerDelegate::~FileRunnerDelegate() { | 41 FileRunnerDelegate::~FileRunnerDelegate() { |
40 } | 42 } |
41 | 43 |
42 void FileRunnerDelegate::UnhandledException(ShellRunner* runner, | 44 void FileRunnerDelegate::UnhandledException(ShellRunner* runner, |
43 TryCatch& try_catch) { | 45 TryCatch& try_catch) { |
44 ModuleRunnerDelegate::UnhandledException(runner, try_catch); | 46 ModuleRunnerDelegate::UnhandledException(runner, try_catch); |
45 FAIL() << try_catch.GetStackTrace(); | 47 FAIL() << try_catch.GetStackTrace(); |
46 } | 48 } |
(...skipping 19 matching lines...) Expand all Loading... |
66 message_loop.Run(); | 68 message_loop.Run(); |
67 } | 69 } |
68 | 70 |
69 v8::Handle<v8::Value> result = runner.global()->Get( | 71 v8::Handle<v8::Value> result = runner.global()->Get( |
70 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); | 72 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); |
71 EXPECT_EQ("PASS", V8ToString(result)); | 73 EXPECT_EQ("PASS", V8ToString(result)); |
72 } | 74 } |
73 } | 75 } |
74 | 76 |
75 } // namespace gin | 77 } // namespace gin |
OLD | NEW |