OLD | NEW |
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 471 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 | 482 |
483 if (notify) | 483 if (notify) |
484 GetWebView()->acceptLanguagesChanged(); | 484 GetWebView()->acceptLanguagesChanged(); |
485 } | 485 } |
486 | 486 |
487 void WebTestProxyBase::CopyImageAtAndCapturePixels( | 487 void WebTestProxyBase::CopyImageAtAndCapturePixels( |
488 int x, int y, const base::Callback<void(const SkBitmap&)>& callback) { | 488 int x, int y, const base::Callback<void(const SkBitmap&)>& callback) { |
489 // It may happen that there is a scheduled animation and | 489 // It may happen that there is a scheduled animation and |
490 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise | 490 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise |
491 // isAcceleratedCompositingActive will return false; | 491 // isAcceleratedCompositingActive will return false; |
| 492 // TODO(enne): remove this: http://crbug.com/397321 |
492 AnimateNow(); | 493 AnimateNow(); |
493 | 494 |
494 DCHECK(web_widget_->isAcceleratedCompositingActive()); | |
495 DCHECK(!callback.is_null()); | 495 DCHECK(!callback.is_null()); |
496 uint64_t sequence_number = blink::Platform::current()->clipboard()-> | 496 uint64_t sequence_number = blink::Platform::current()->clipboard()-> |
497 sequenceNumber(blink::WebClipboard::Buffer()); | 497 sequenceNumber(blink::WebClipboard::Buffer()); |
498 GetWebView()->copyImageAt(blink::WebPoint(x, y)); | 498 GetWebView()->copyImageAt(blink::WebPoint(x, y)); |
499 if (sequence_number == blink::Platform::current()->clipboard()-> | 499 if (sequence_number == blink::Platform::current()->clipboard()-> |
500 sequenceNumber(blink::WebClipboard::Buffer())) { | 500 sequenceNumber(blink::WebClipboard::Buffer())) { |
501 SkBitmap emptyBitmap; | 501 SkBitmap emptyBitmap; |
502 callback.Run(emptyBitmap); | 502 callback.Run(emptyBitmap); |
503 return; | 503 return; |
504 } | 504 } |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
567 delete this; | 567 delete this; |
568 } | 568 } |
569 | 569 |
570 void WebTestProxyBase::CapturePixelsAsync( | 570 void WebTestProxyBase::CapturePixelsAsync( |
571 const base::Callback<void(const SkBitmap&)>& callback) { | 571 const base::Callback<void(const SkBitmap&)>& callback) { |
572 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); | 572 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); |
573 | 573 |
574 // It may happen that there is a scheduled animation and | 574 // It may happen that there is a scheduled animation and |
575 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise | 575 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise |
576 // isAcceleratedCompositingActive will return false; | 576 // isAcceleratedCompositingActive will return false; |
| 577 // TODO(enne): remove this: http://crbug.com/397321 |
577 AnimateNow(); | 578 AnimateNow(); |
578 | 579 |
579 DCHECK(web_widget_->isAcceleratedCompositingActive()); | |
580 DCHECK(!callback.is_null()); | 580 DCHECK(!callback.is_null()); |
581 | 581 |
582 if (test_interfaces_->GetTestRunner()->isPrinting()) { | 582 if (test_interfaces_->GetTestRunner()->isPrinting()) { |
583 base::MessageLoopProxy::current()->PostTask( | 583 base::MessageLoopProxy::current()->PostTask( |
584 FROM_HERE, | 584 FROM_HERE, |
585 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting, | 585 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting, |
586 base::Unretained(this), | 586 base::Unretained(this), |
587 callback)); | 587 callback)); |
588 return; | 588 return; |
589 } | 589 } |
(...skipping 29 matching lines...) Expand all Loading... |
619 if (!callback.is_null()) | 619 if (!callback.is_null()) |
620 callback.Run(); | 620 callback.Run(); |
621 } | 621 } |
622 | 622 |
623 void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) { | 623 void WebTestProxyBase::DisplayAsyncThen(const base::Closure& callback) { |
624 TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen"); | 624 TRACE_EVENT0("shell", "WebTestProxyBase::DisplayAsyncThen"); |
625 | 625 |
626 // It may happen that there is a scheduled animation and | 626 // It may happen that there is a scheduled animation and |
627 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise | 627 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise |
628 // isAcceleratedCompositingActive will return false; | 628 // isAcceleratedCompositingActive will return false; |
| 629 // TODO(enne): remove this: http://crbug.com/397321 |
629 AnimateNow(); | 630 AnimateNow(); |
630 | 631 |
631 CHECK(web_widget_->isAcceleratedCompositingActive()); | |
632 CapturePixelsAsync(base::Bind( | 632 CapturePixelsAsync(base::Bind( |
633 &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback)); | 633 &WebTestProxyBase::DidDisplayAsync, base::Unretained(this), callback)); |
634 } | 634 } |
635 | 635 |
636 void WebTestProxyBase::GetScreenOrientationForTesting( | 636 void WebTestProxyBase::GetScreenOrientationForTesting( |
637 blink::WebScreenInfo& screen_info) { | 637 blink::WebScreenInfo& screen_info) { |
638 if (!screen_orientation_client_) | 638 if (!screen_orientation_client_) |
639 return; | 639 return; |
640 // Override screen orientation information with mock data. | 640 // Override screen orientation information with mock data. |
641 screen_info.orientationType = | 641 screen_info.orientationType = |
(...skipping 711 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1353 if (!push_client_.get()) | 1353 if (!push_client_.get()) |
1354 push_client_.reset(new MockWebPushClient); | 1354 push_client_.reset(new MockWebPushClient); |
1355 return push_client_.get(); | 1355 return push_client_.get(); |
1356 } | 1356 } |
1357 | 1357 |
1358 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1358 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
1359 return GetPushClientMock(); | 1359 return GetPushClientMock(); |
1360 } | 1360 } |
1361 | 1361 |
1362 } // namespace content | 1362 } // namespace content |
OLD | NEW |