Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(101)

Side by Side Diff: content/shell/renderer/layout_test/blink_test_runner.cc

Issue 1715573002: Replicating LayoutDumpFlags across OOPIFs. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@replicating-pixel-dump-flag
Patch Set: Rebasing... Created 4 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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/layout_test/blink_test_runner.h" 5 #include "content/shell/renderer/layout_test/blink_test_runner.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 #include <algorithm> 8 #include <algorithm>
9 #include <clocale> 9 #include <clocale>
10 #include <cmath> 10 #include <cmath>
(...skipping 16 matching lines...) Expand all
27 #include "base/thread_task_runner_handle.h" 27 #include "base/thread_task_runner_handle.h"
28 #include "base/time/time.h" 28 #include "base/time/time.h"
29 #include "build/build_config.h" 29 #include "build/build_config.h"
30 #include "components/plugins/renderer/plugin_placeholder.h" 30 #include "components/plugins/renderer/plugin_placeholder.h"
31 #include "components/test_runner/app_banner_client.h" 31 #include "components/test_runner/app_banner_client.h"
32 #include "components/test_runner/gamepad_controller.h" 32 #include "components/test_runner/gamepad_controller.h"
33 #include "components/test_runner/layout_dump.h" 33 #include "components/test_runner/layout_dump.h"
34 #include "components/test_runner/layout_dump_flags.h" 34 #include "components/test_runner/layout_dump_flags.h"
35 #include "components/test_runner/mock_screen_orientation_client.h" 35 #include "components/test_runner/mock_screen_orientation_client.h"
36 #include "components/test_runner/test_interfaces.h" 36 #include "components/test_runner/test_interfaces.h"
37 #include "components/test_runner/tracked_dictionary.h"
37 #include "components/test_runner/web_task.h" 38 #include "components/test_runner/web_task.h"
38 #include "components/test_runner/web_test_interfaces.h" 39 #include "components/test_runner/web_test_interfaces.h"
39 #include "components/test_runner/web_test_proxy.h" 40 #include "components/test_runner/web_test_proxy.h"
40 #include "components/test_runner/web_test_runner.h" 41 #include "components/test_runner/web_test_runner.h"
41 #include "content/public/common/content_switches.h" 42 #include "content/public/common/content_switches.h"
42 #include "content/public/common/url_constants.h" 43 #include "content/public/common/url_constants.h"
43 #include "content/public/common/web_preferences.h" 44 #include "content/public/common/web_preferences.h"
44 #include "content/public/renderer/media_stream_api.h" 45 #include "content/public/renderer/media_stream_api.h"
45 #include "content/public/renderer/render_frame.h" 46 #include "content/public/renderer/render_frame.h"
46 #include "content/public/renderer/render_view.h" 47 #include "content/public/renderer/render_view.h"
(...skipping 24 matching lines...) Expand all
71 #include "third_party/WebKit/public/platform/WebURLError.h" 72 #include "third_party/WebKit/public/platform/WebURLError.h"
72 #include "third_party/WebKit/public/platform/WebURLRequest.h" 73 #include "third_party/WebKit/public/platform/WebURLRequest.h"
73 #include "third_party/WebKit/public/platform/WebURLResponse.h" 74 #include "third_party/WebKit/public/platform/WebURLResponse.h"
74 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h" 75 #include "third_party/WebKit/public/platform/modules/app_banner/WebAppBannerProm ptReply.h"
75 #include "third_party/WebKit/public/web/WebArrayBufferView.h" 76 #include "third_party/WebKit/public/web/WebArrayBufferView.h"
76 #include "third_party/WebKit/public/web/WebContextMenuData.h" 77 #include "third_party/WebKit/public/web/WebContextMenuData.h"
77 #include "third_party/WebKit/public/web/WebDataSource.h" 78 #include "third_party/WebKit/public/web/WebDataSource.h"
78 #include "third_party/WebKit/public/web/WebDevToolsAgent.h" 79 #include "third_party/WebKit/public/web/WebDevToolsAgent.h"
79 #include "third_party/WebKit/public/web/WebDocument.h" 80 #include "third_party/WebKit/public/web/WebDocument.h"
80 #include "third_party/WebKit/public/web/WebElement.h" 81 #include "third_party/WebKit/public/web/WebElement.h"
82 #include "third_party/WebKit/public/web/WebFrame.h"
81 #include "third_party/WebKit/public/web/WebHistoryItem.h" 83 #include "third_party/WebKit/public/web/WebHistoryItem.h"
82 #include "third_party/WebKit/public/web/WebKit.h" 84 #include "third_party/WebKit/public/web/WebKit.h"
83 #include "third_party/WebKit/public/web/WebLeakDetector.h" 85 #include "third_party/WebKit/public/web/WebLeakDetector.h"
84 #include "third_party/WebKit/public/web/WebLocalFrame.h" 86 #include "third_party/WebKit/public/web/WebLocalFrame.h"
85 #include "third_party/WebKit/public/web/WebScriptSource.h" 87 #include "third_party/WebKit/public/web/WebScriptSource.h"
86 #include "third_party/WebKit/public/web/WebTestingSupport.h" 88 #include "third_party/WebKit/public/web/WebTestingSupport.h"
87 #include "third_party/WebKit/public/web/WebView.h" 89 #include "third_party/WebKit/public/web/WebView.h"
88 #include "ui/gfx/geometry/rect.h" 90 #include "ui/gfx/geometry/rect.h"
89 91
90 using blink::Platform; 92 using blink::Platform;
91 using blink::WebArrayBufferView; 93 using blink::WebArrayBufferView;
92 using blink::WebContextMenuData; 94 using blink::WebContextMenuData;
93 using blink::WebDevToolsAgent; 95 using blink::WebDevToolsAgent;
94 using blink::WebDeviceMotionData; 96 using blink::WebDeviceMotionData;
95 using blink::WebDeviceOrientationData; 97 using blink::WebDeviceOrientationData;
96 using blink::WebElement; 98 using blink::WebElement;
97 using blink::WebLocalFrame; 99 using blink::WebLocalFrame;
98 using blink::WebHistoryItem; 100 using blink::WebHistoryItem;
101 using blink::WebFrame;
99 using blink::WebLocalFrame; 102 using blink::WebLocalFrame;
100 using blink::WebPoint; 103 using blink::WebPoint;
101 using blink::WebRect; 104 using blink::WebRect;
102 using blink::WebScriptSource; 105 using blink::WebScriptSource;
103 using blink::WebSize; 106 using blink::WebSize;
104 using blink::WebString; 107 using blink::WebString;
105 using blink::WebURL; 108 using blink::WebURL;
106 using blink::WebURLError; 109 using blink::WebURLError;
107 using blink::WebURLRequest; 110 using blink::WebURLRequest;
108 using blink::WebScreenOrientationType; 111 using blink::WebScreenOrientationType;
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
603 result = result.substr(0, strlen("file:///")) + 606 result = result.substr(0, strlen("file:///")) +
604 result.substr(strlen("file:////")); 607 result.substr(strlen("file:////"));
605 } 608 }
606 return RewriteLayoutTestsURL(result).string().utf8(); 609 return RewriteLayoutTestsURL(result).string().utf8();
607 } 610 }
608 611
609 void BlinkTestRunner::SetLocale(const std::string& locale) { 612 void BlinkTestRunner::SetLocale(const std::string& locale) {
610 setlocale(LC_ALL, locale.c_str()); 613 setlocale(LC_ALL, locale.c_str());
611 } 614 }
612 615
616 void BlinkTestRunner::OnLayoutDumpFlagsChanged(
617 test_runner::LayoutDumpFlags* layout_dump_flags) {
618 // Ignore changes that happen before we got the initial, accumulated
619 // layout flag changes in ShellViewMsg_ReplicateTestConfiguration.
620 if (!is_main_window_)
621 return;
622
623 const base::DictionaryValue& changed_values =
624 layout_dump_flags->tracked_dictionary().changed_values();
625
626 // Message needs to be send via a local frame to eventually reach
627 // WebContentsObserver via OnMessage(..., RenderFrameHost*) overload - this
628 // lets BlinkTestController figure out the originator of the message.
629 RenderFrame* local_frame = nullptr;
630 for (WebFrame* frame = render_view()->GetWebView()->mainFrame(); frame;
631 frame = frame->traverseNext(false)) {
632 if (frame->isWebLocalFrame()) {
633 local_frame = RenderFrame::FromWebFrame(frame);
634 break;
635 }
636 }
637 DCHECK(local_frame);
638 Send(new ShellViewHostMsg_LayoutDumpFlagsChanged(local_frame->GetRoutingID(),
639 changed_values));
640
641 layout_dump_flags->tracked_dictionary().ResetChangeTracking();
642 }
643
613 void BlinkTestRunner::TestFinished() { 644 void BlinkTestRunner::TestFinished() {
614 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) { 645 if (!is_main_window_ || !render_view()->GetMainRenderFrame()) {
615 Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id())); 646 Send(new ShellViewHostMsg_TestFinishedInSecondaryRenderer(routing_id()));
616 return; 647 return;
617 } 648 }
618 test_runner::WebTestInterfaces* interfaces = 649 test_runner::WebTestInterfaces* interfaces =
619 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); 650 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces();
620 interfaces->SetTestIsRunning(false); 651 interfaces->SetTestIsRunning(false);
621 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { 652 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) {
622 SyncNavigationStateVisitor visitor; 653 SyncNavigationStateVisitor visitor;
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
889 920
890 const test_runner::LayoutDumpFlags& layout_dump_flags = 921 const test_runner::LayoutDumpFlags& layout_dump_flags =
891 interfaces->TestRunner()->GetLayoutDumpFlags(); 922 interfaces->TestRunner()->GetLayoutDumpFlags();
892 if (!layout_dump_flags.dump_child_frames()) { 923 if (!layout_dump_flags.dump_child_frames()) {
893 std::string layout_dump = DumpLayout( 924 std::string layout_dump = DumpLayout(
894 render_view()->GetMainRenderFrame()->GetWebFrame(), layout_dump_flags); 925 render_view()->GetMainRenderFrame()->GetWebFrame(), layout_dump_flags);
895 OnLayoutDumpCompleted(layout_dump); 926 OnLayoutDumpCompleted(layout_dump);
896 return; 927 return;
897 } 928 }
898 929
899 Send( 930 Send(new ShellViewHostMsg_InitiateLayoutDump(routing_id()));
900 new ShellViewHostMsg_InitiateLayoutDump(routing_id(), layout_dump_flags));
901 // OnLayoutDumpCompleted will be eventually called by an IPC from the browser. 931 // OnLayoutDumpCompleted will be eventually called by an IPC from the browser.
902 } 932 }
903 933
904 void BlinkTestRunner::OnLayoutDumpCompleted(std::string completed_layout_dump) { 934 void BlinkTestRunner::OnLayoutDumpCompleted(std::string completed_layout_dump) {
905 test_runner::WebTestInterfaces* interfaces = 935 test_runner::WebTestInterfaces* interfaces =
906 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces(); 936 LayoutTestRenderProcessObserver::GetInstance()->test_interfaces();
907 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) { 937 if (interfaces->TestRunner()->ShouldDumpBackForwardList()) {
908 completed_layout_dump.append(proxy()->DumpBackForwardLists()); 938 completed_layout_dump.append(proxy()->DumpBackForwardLists());
909 } 939 }
910 940
(...skipping 122 matching lines...) Expand 10 before | Expand all | Expand 10 after
1033 get_bluetooth_events_callbacks_.pop_front(); 1063 get_bluetooth_events_callbacks_.pop_front();
1034 callback.Run(events); 1064 callback.Run(events);
1035 } 1065 }
1036 1066
1037 void BlinkTestRunner::ReportLeakDetectionResult( 1067 void BlinkTestRunner::ReportLeakDetectionResult(
1038 const LeakDetectionResult& report) { 1068 const LeakDetectionResult& report) {
1039 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 1069 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
1040 } 1070 }
1041 1071
1042 } // namespace content 1072 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698