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