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/renderer/webkit_test_runner.h" | 5 #include "content/shell/renderer/webkit_test_runner.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <clocale> | 8 #include <clocale> |
9 #include <cmath> | 9 #include <cmath> |
10 | 10 |
(...skipping 168 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
179 WebURLRequest(GURL(kAboutBlankURL))); | 179 WebURLRequest(GURL(kAboutBlankURL))); |
180 return true; | 180 return true; |
181 } | 181 } |
182 | 182 |
183 private: | 183 private: |
184 RenderView* main_render_view_; | 184 RenderView* main_render_view_; |
185 | 185 |
186 DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); | 186 DISALLOW_COPY_AND_ASSIGN(NavigateAwayVisitor); |
187 }; | 187 }; |
188 | 188 |
| 189 class UseSynchronousResizeModeVisitor : public RenderViewVisitor { |
| 190 public: |
| 191 explicit UseSynchronousResizeModeVisitor(bool enable) : enable_(enable) {} |
| 192 virtual ~UseSynchronousResizeModeVisitor() {} |
| 193 |
| 194 virtual bool Visit(RenderView* render_view) OVERRIDE { |
| 195 UseSynchronousResizeMode(render_view, enable_); |
| 196 return true; |
| 197 } |
| 198 |
| 199 private: |
| 200 bool enable_; |
| 201 }; |
| 202 |
189 } // namespace | 203 } // namespace |
190 | 204 |
191 WebKitTestRunner::WebKitTestRunner(RenderView* render_view) | 205 WebKitTestRunner::WebKitTestRunner(RenderView* render_view) |
192 : RenderViewObserver(render_view), | 206 : RenderViewObserver(render_view), |
193 RenderViewObserverTracker<WebKitTestRunner>(render_view), | 207 RenderViewObserverTracker<WebKitTestRunner>(render_view), |
194 proxy_(NULL), | 208 proxy_(NULL), |
195 focused_view_(NULL), | 209 focused_view_(NULL), |
196 is_main_window_(false), | 210 is_main_window_(false), |
197 focus_on_next_commit_(false) { | 211 focus_on_next_commit_(false) { |
198 UseMockMediaStreams(render_view); | 212 UseMockMediaStreams(render_view); |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
343 } | 357 } |
344 } else { | 358 } else { |
345 DLOG(WARNING) << "Unknown error domain"; | 359 DLOG(WARNING) << "Unknown error domain"; |
346 } | 360 } |
347 | 361 |
348 return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", | 362 return base::StringPrintf("<NSError domain %s, code %d, failing URL \"%s\">", |
349 domain.c_str(), code, error.unreachableURL.spec().data()); | 363 domain.c_str(), code, error.unreachableURL.spec().data()); |
350 } | 364 } |
351 | 365 |
352 void WebKitTestRunner::useUnfortunateSynchronousResizeMode(bool enable) { | 366 void WebKitTestRunner::useUnfortunateSynchronousResizeMode(bool enable) { |
353 UseSynchronousResizeMode(render_view(), enable); | 367 UseSynchronousResizeModeVisitor visitor(enable); |
| 368 RenderView::ForEach(&visitor); |
354 } | 369 } |
355 | 370 |
356 void WebKitTestRunner::enableAutoResizeMode(const WebSize& min_size, | 371 void WebKitTestRunner::enableAutoResizeMode(const WebSize& min_size, |
357 const WebSize& max_size) { | 372 const WebSize& max_size) { |
358 EnableAutoResizeMode(render_view(), min_size, max_size); | 373 EnableAutoResizeMode(render_view(), min_size, max_size); |
359 } | 374 } |
360 | 375 |
361 void WebKitTestRunner::disableAutoResizeMode(const WebSize& new_size) { | 376 void WebKitTestRunner::disableAutoResizeMode(const WebSize& new_size) { |
362 DisableAutoResizeMode(render_view(), new_size); | 377 DisableAutoResizeMode(render_view(), new_size); |
363 if (!new_size.isEmpty()) | 378 if (!new_size.isEmpty()) |
(...skipping 317 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
681 WebURLRequest(GURL(kAboutBlankURL))); | 696 WebURLRequest(GURL(kAboutBlankURL))); |
682 Send(new ShellViewHostMsg_ResetDone(routing_id())); | 697 Send(new ShellViewHostMsg_ResetDone(routing_id())); |
683 } | 698 } |
684 | 699 |
685 void WebKitTestRunner::OnNotifyDone() { | 700 void WebKitTestRunner::OnNotifyDone() { |
686 render_view()->GetWebView()->mainFrame()->executeScript( | 701 render_view()->GetWebView()->mainFrame()->executeScript( |
687 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); | 702 WebScriptSource(WebString::fromUTF8("testRunner.notifyDone();"))); |
688 } | 703 } |
689 | 704 |
690 } // namespace content | 705 } // namespace content |
OLD | NEW |