OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "content/shell/layout_test_controller_host.h" | 5 #include "content/shell/layout_test_controller_host.h" |
6 | 6 |
| 7 #include "base/command_line.h" |
7 #include "base/message_loop.h" | 8 #include "base/message_loop.h" |
8 #include "content/public/browser/render_view_host.h" | 9 #include "content/public/browser/render_view_host.h" |
9 #include "content/shell/shell_messages.h" | 10 #include "content/shell/shell_messages.h" |
| 11 #include "content/shell/shell_switches.h" |
10 #include "webkit/support/webkit_support_gfx.h" | 12 #include "webkit/support/webkit_support_gfx.h" |
11 | 13 |
12 namespace content { | 14 namespace content { |
13 | 15 |
14 namespace { | 16 namespace { |
15 const int kTestTimeoutMilliseconds = 30 * 1000; | 17 const int kTestTimeoutMilliseconds = 30 * 1000; |
16 } // namespace | 18 } // namespace |
17 | 19 |
18 std::map<RenderViewHost*, LayoutTestControllerHost*> | 20 std::map<RenderViewHost*, LayoutTestControllerHost*> |
19 LayoutTestControllerHost::controllers_; | 21 LayoutTestControllerHost::controllers_; |
(...skipping 157 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
177 should_stay_on_page_after_handling_before_unload_ = should_stay_on_page; | 179 should_stay_on_page_after_handling_before_unload_ = should_stay_on_page; |
178 } | 180 } |
179 | 181 |
180 void LayoutTestControllerHost::OnDumpChildFramesAsText() { | 182 void LayoutTestControllerHost::OnDumpChildFramesAsText() { |
181 dump_child_frames_ = true; | 183 dump_child_frames_ = true; |
182 } | 184 } |
183 | 185 |
184 void LayoutTestControllerHost::OnWaitUntilDone() { | 186 void LayoutTestControllerHost::OnWaitUntilDone() { |
185 if (wait_until_done_) | 187 if (wait_until_done_) |
186 return; | 188 return; |
187 watchdog_.Reset(base::Bind(&LayoutTestControllerHost::TimeoutHandler, | 189 if (!CommandLine::ForCurrentProcess()->HasSwitch(switches::kNoTimeout)) { |
188 base::Unretained(this))); | 190 watchdog_.Reset(base::Bind(&LayoutTestControllerHost::TimeoutHandler, |
189 MessageLoop::current()->PostDelayedTask( | 191 base::Unretained(this))); |
190 FROM_HERE, | 192 MessageLoop::current()->PostDelayedTask( |
191 watchdog_.callback(), | 193 FROM_HERE, |
192 base::TimeDelta::FromMilliseconds(kTestTimeoutMilliseconds)); | 194 watchdog_.callback(), |
| 195 base::TimeDelta::FromMilliseconds(kTestTimeoutMilliseconds)); |
| 196 } |
193 wait_until_done_ = true; | 197 wait_until_done_ = true; |
194 } | 198 } |
195 | 199 |
196 void LayoutTestControllerHost::OnNotImplemented( | 200 void LayoutTestControllerHost::OnNotImplemented( |
197 const std::string& object_name, | 201 const std::string& object_name, |
198 const std::string& property_name) { | 202 const std::string& property_name) { |
199 if (captured_dump_) | 203 if (captured_dump_) |
200 return; | 204 return; |
201 printf("FAIL: NOT IMPLEMENTED: %s.%s\n", | 205 printf("FAIL: NOT IMPLEMENTED: %s.%s\n", |
202 object_name.c_str(), property_name.c_str()); | 206 object_name.c_str(), property_name.c_str()); |
203 fprintf(stderr, "FAIL: NOT IMPLEMENTED: %s.%s\n", | 207 fprintf(stderr, "FAIL: NOT IMPLEMENTED: %s.%s\n", |
204 object_name.c_str(), property_name.c_str()); | 208 object_name.c_str(), property_name.c_str()); |
205 watchdog_.Cancel(); | 209 watchdog_.Cancel(); |
206 CaptureDump(); | 210 CaptureDump(); |
207 } | 211 } |
208 | 212 |
209 } // namespace content | 213 } // namespace content |
OLD | NEW |