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

Side by Side Diff: content/shell/renderer/test_runner/web_test_proxy.cc

Issue 904833004: Add test_runner hook to dump drag image. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address comments Created 5 years, 10 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/test_runner/web_test_proxy.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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/test_runner/web_test_proxy.h" 5 #include "content/shell/renderer/test_runner/web_test_proxy.h"
6 6
7 #include <cctype> 7 #include <cctype>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/command_line.h" 10 #include "base/command_line.h"
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
558 canvas.drawBitmap(bitmap, popup_position_.x(), popup_position_.y()); 558 canvas.drawBitmap(bitmap, popup_position_.x(), popup_position_.y());
559 callback_.Run(main_bitmap_); 559 callback_.Run(main_bitmap_);
560 delete this; 560 delete this;
561 } 561 }
562 562
563 void WebTestProxyBase::CapturePixelsAsync( 563 void WebTestProxyBase::CapturePixelsAsync(
564 const base::Callback<void(const SkBitmap&)>& callback) { 564 const base::Callback<void(const SkBitmap&)>& callback) {
565 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); 565 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync");
566 DCHECK(!callback.is_null()); 566 DCHECK(!callback.is_null());
567 567
568 if (!drag_image_.isNull()) {
Justin Novosad 2015/02/13 03:00:05 Theory on why this this CL introduced flake: drag_
jackhou1 2015/02/13 04:54:44 Yeah that does fix the flakiness: https://coderevi
569 callback.Run(drag_image_.getSkBitmap());
570 return;
571 }
572
568 if (test_interfaces_->GetTestRunner()->isPrinting()) { 573 if (test_interfaces_->GetTestRunner()->isPrinting()) {
569 base::MessageLoopProxy::current()->PostTask( 574 base::MessageLoopProxy::current()->PostTask(
570 FROM_HERE, 575 FROM_HERE,
571 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting, 576 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting,
572 base::Unretained(this), 577 base::Unretained(this),
573 callback)); 578 callback));
574 return; 579 return;
575 } 580 }
576 581
577 CaptureCallback* capture_callback = new CaptureCallback(base::Bind( 582 CaptureCallback* capture_callback = new CaptureCallback(base::Bind(
(...skipping 221 matching lines...) Expand 10 before | Expand all | Expand 10 after
799 804
800 delegate_->PrintMessage(message + "\n"); 805 delegate_->PrintMessage(message + "\n");
801 } 806 }
802 } 807 }
803 808
804 void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame, 809 void WebTestProxyBase::StartDragging(blink::WebLocalFrame* frame,
805 const blink::WebDragData& data, 810 const blink::WebDragData& data,
806 blink::WebDragOperationsMask mask, 811 blink::WebDragOperationsMask mask,
807 const blink::WebImage& image, 812 const blink::WebImage& image,
808 const blink::WebPoint& point) { 813 const blink::WebPoint& point) {
814 if (test_interfaces_->GetTestRunner()->shouldDumpDragImage()) {
815 if (drag_image_.isNull())
816 drag_image_ = image;
817 }
809 // When running a test, we need to fake a drag drop operation otherwise 818 // When running a test, we need to fake a drag drop operation otherwise
810 // Windows waits for real mouse events to know when the drag is over. 819 // Windows waits for real mouse events to know when the drag is over.
811 test_interfaces_->GetEventSender()->DoDragDrop(data, mask); 820 test_interfaces_->GetEventSender()->DoDragDrop(data, mask);
812 } 821 }
813 822
814 // The output from these methods in layout test mode should match that 823 // The output from these methods in layout test mode should match that
815 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree. 824 // expected by the layout tests. See EditingDelegate.m in DumpRenderTree.
816 825
817 void WebTestProxyBase::DidChangeSelection(bool is_empty_callback) { 826 void WebTestProxyBase::DidChangeSelection(bool is_empty_callback) {
818 if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks()) 827 if (test_interfaces_->GetTestRunner()->shouldDumpEditingCallbacks())
(...skipping 494 matching lines...) Expand 10 before | Expand all | Expand 10 after
1313 // to cancel the input method's ongoing composition session. 1322 // to cancel the input method's ongoing composition session.
1314 if (web_widget_) 1323 if (web_widget_)
1315 web_widget_->confirmComposition(); 1324 web_widget_->confirmComposition();
1316 } 1325 }
1317 1326
1318 blink::WebString WebTestProxyBase::acceptLanguages() { 1327 blink::WebString WebTestProxyBase::acceptLanguages() {
1319 return blink::WebString::fromUTF8(accept_languages_); 1328 return blink::WebString::fromUTF8(accept_languages_);
1320 } 1329 }
1321 1330
1322 } // namespace content 1331 } // namespace content
OLDNEW
« no previous file with comments | « content/shell/renderer/test_runner/web_test_proxy.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698