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" |
(...skipping 37 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
48 } | 48 } |
49 | 49 |
50 void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, | 50 void RunTestFromFile(const base::FilePath& path, FileRunnerDelegate* delegate, |
51 bool run_until_idle) { | 51 bool run_until_idle) { |
52 ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName(); | 52 ASSERT_TRUE(base::PathExists(path)) << path.LossyDisplayName(); |
53 std::string source; | 53 std::string source; |
54 ASSERT_TRUE(ReadFileToString(path, &source)); | 54 ASSERT_TRUE(ReadFileToString(path, &source)); |
55 | 55 |
56 base::MessageLoop message_loop; | 56 base::MessageLoop message_loop; |
57 | 57 |
58 gin::IsolateHolder instance; | 58 gin::IsolateHolder instance(gin::IsolateHolder::kStrictMode); |
59 gin::ShellRunner runner(delegate, instance.isolate()); | 59 gin::ShellRunner runner(delegate, instance.isolate()); |
60 { | 60 { |
61 gin::Runner::Scope scope(&runner); | 61 gin::Runner::Scope scope(&runner); |
62 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); | 62 v8::V8::SetCaptureStackTraceForUncaughtExceptions(true); |
63 runner.Run(source, path.AsUTF8Unsafe()); | 63 runner.Run(source, path.AsUTF8Unsafe()); |
64 | 64 |
65 if (run_until_idle) { | 65 if (run_until_idle) { |
66 message_loop.RunUntilIdle(); | 66 message_loop.RunUntilIdle(); |
67 } else { | 67 } else { |
68 message_loop.Run(); | 68 message_loop.Run(); |
69 } | 69 } |
70 | 70 |
71 v8::Handle<v8::Value> result = runner.global()->Get( | 71 v8::Handle<v8::Value> result = runner.global()->Get( |
72 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); | 72 StringToSymbol(runner.GetContextHolder()->isolate(), "result")); |
73 EXPECT_EQ("PASS", V8ToString(result)); | 73 EXPECT_EQ("PASS", V8ToString(result)); |
74 } | 74 } |
75 } | 75 } |
76 | 76 |
77 } // namespace gin | 77 } // namespace gin |
OLD | NEW |