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

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

Issue 1886013002: Track focused view in TestRunner instead of in BlinkTestRunner. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 8 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
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 8
9 #include <algorithm> 9 #include <algorithm>
10 #include <clocale> 10 #include <clocale>
(...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after
201 protected: 201 protected:
202 ~MockAudioCapturerSource() override {} 202 ~MockAudioCapturerSource() override {}
203 }; 203 };
204 204
205 } // namespace 205 } // namespace
206 206
207 BlinkTestRunner::BlinkTestRunner(RenderView* render_view) 207 BlinkTestRunner::BlinkTestRunner(RenderView* render_view)
208 : RenderViewObserver(render_view), 208 : RenderViewObserver(render_view),
209 RenderViewObserverTracker<BlinkTestRunner>(render_view), 209 RenderViewObserverTracker<BlinkTestRunner>(render_view),
210 proxy_(NULL), 210 proxy_(NULL),
211 focused_view_(NULL),
212 is_main_window_(false), 211 is_main_window_(false),
213 focus_on_next_commit_(false), 212 focus_on_next_commit_(false),
214 leak_detector_(new LeakDetector(this)) { 213 leak_detector_(new LeakDetector(this)) {
215 } 214 }
216 215
217 BlinkTestRunner::~BlinkTestRunner() { 216 BlinkTestRunner::~BlinkTestRunner() {
218 } 217 }
219 218
220 // WebTestDelegate ----------------------------------------------------------- 219 // WebTestDelegate -----------------------------------------------------------
221 220
(...skipping 262 matching lines...) Expand 10 before | Expand all | Expand 10 after
484 content::ClearGeofencingMockProvider(); 483 content::ClearGeofencingMockProvider();
485 } 484 }
486 485
487 void BlinkTestRunner::SetGeofencingMockPosition(double latitude, 486 void BlinkTestRunner::SetGeofencingMockPosition(double latitude,
488 double longitude) { 487 double longitude) {
489 content::SetGeofencingMockPosition(latitude, longitude); 488 content::SetGeofencingMockPosition(latitude, longitude);
490 } 489 }
491 490
492 void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) { 491 void BlinkTestRunner::SetFocus(blink::WebView* web_view, bool focus) {
493 RenderView* render_view = RenderView::FromWebView(web_view); 492 RenderView* render_view = RenderView::FromWebView(web_view);
494 if (!render_view) { 493 if (render_view) // Check whether |web_view| has been already closed.
495 NOTREACHED(); 494 SetFocusAndActivate(render_view, focus);
496 return;
497 }
498
499 // Check whether the focused view was closed meanwhile.
500 if (!BlinkTestRunner::Get(focused_view_))
501 focused_view_ = NULL;
502
503 if (focus) {
504 if (focused_view_ != render_view) {
505 if (focused_view_)
506 SetFocusAndActivate(focused_view_, false);
507 SetFocusAndActivate(render_view, true);
508 focused_view_ = render_view;
509 }
510 } else {
511 if (focused_view_ == render_view) {
512 SetFocusAndActivate(render_view, false);
513 focused_view_ = NULL;
514 }
515 }
516 } 495 }
517 496
518 void BlinkTestRunner::SetAcceptAllCookies(bool accept) { 497 void BlinkTestRunner::SetAcceptAllCookies(bool accept) {
519 Send(new LayoutTestHostMsg_AcceptAllCookies(routing_id(), accept)); 498 Send(new LayoutTestHostMsg_AcceptAllCookies(routing_id(), accept));
520 } 499 }
521 500
522 std::string BlinkTestRunner::PathToLocalResource(const std::string& resource) { 501 std::string BlinkTestRunner::PathToLocalResource(const std::string& resource) {
523 #if defined(OS_WIN) 502 #if defined(OS_WIN)
524 if (resource.find("/tmp/") == 0) { 503 if (resource.find("/tmp/") == 0) {
525 // We want a temp file. 504 // We want a temp file.
(...skipping 408 matching lines...) Expand 10 before | Expand all | Expand 10 after
934 params.enable_pixel_dumping); 913 params.enable_pixel_dumping);
935 } 914 }
936 915
937 void BlinkTestRunner::OnSetTestConfiguration( 916 void BlinkTestRunner::OnSetTestConfiguration(
938 const ShellTestConfiguration& params) { 917 const ShellTestConfiguration& params) {
939 OnReplicateTestConfiguration(params); 918 OnReplicateTestConfiguration(params);
940 919
941 ForceResizeRenderView( 920 ForceResizeRenderView(
942 render_view(), 921 render_view(),
943 WebSize(params.initial_size.width(), params.initial_size.height())); 922 WebSize(params.initial_size.width(), params.initial_size.height()));
944 SetFocus(proxy_->web_view(), true); 923 LayoutTestRenderProcessObserver::GetInstance()
924 ->test_interfaces()
925 ->TestRunner()
926 ->SetFocus(render_view()->GetWebView(), true);
945 } 927 }
946 928
947 void BlinkTestRunner::OnSessionHistory( 929 void BlinkTestRunner::OnSessionHistory(
948 const std::vector<int>& routing_ids, 930 const std::vector<int>& routing_ids,
949 const std::vector<std::vector<PageState>>& session_histories, 931 const std::vector<std::vector<PageState>>& session_histories,
950 const std::vector<unsigned>& current_entry_indexes) { 932 const std::vector<unsigned>& current_entry_indexes) {
951 routing_ids_ = routing_ids; 933 routing_ids_ = routing_ids;
952 session_histories_ = session_histories; 934 session_histories_ = session_histories;
953 current_entry_indexes_ = current_entry_indexes; 935 current_entry_indexes_ = current_entry_indexes;
954 CaptureDump(); 936 CaptureDump();
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 get_bluetooth_events_callbacks_.pop_front(); 968 get_bluetooth_events_callbacks_.pop_front();
987 callback.Run(events); 969 callback.Run(events);
988 } 970 }
989 971
990 void BlinkTestRunner::ReportLeakDetectionResult( 972 void BlinkTestRunner::ReportLeakDetectionResult(
991 const LeakDetectionResult& report) { 973 const LeakDetectionResult& report) {
992 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report)); 974 Send(new ShellViewHostMsg_LeakDetectionDone(routing_id(), report));
993 } 975 }
994 976
995 } // namespace content 977 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/layout_test/blink_test_runner.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698