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 AnimateNow(); | 492 AnimateNow(); |
danakj
2014/09/24 14:27:38
Can you also remove all these AnimateNow()s that w
enne (OOO)
2014/09/24 16:44:55
I talked to loislo about this and am going to cons
| |
493 | 493 |
494 DCHECK(web_widget_->isAcceleratedCompositingActive()); | |
495 DCHECK(!callback.is_null()); | 494 DCHECK(!callback.is_null()); |
496 uint64_t sequence_number = blink::Platform::current()->clipboard()-> | 495 uint64_t sequence_number = blink::Platform::current()->clipboard()-> |
497 sequenceNumber(blink::WebClipboard::Buffer()); | 496 sequenceNumber(blink::WebClipboard::Buffer()); |
498 GetWebView()->copyImageAt(blink::WebPoint(x, y)); | 497 GetWebView()->copyImageAt(blink::WebPoint(x, y)); |
499 if (sequence_number == blink::Platform::current()->clipboard()-> | 498 if (sequence_number == blink::Platform::current()->clipboard()-> |
500 sequenceNumber(blink::WebClipboard::Buffer())) { | 499 sequenceNumber(blink::WebClipboard::Buffer())) { |
501 SkBitmap emptyBitmap; | 500 SkBitmap emptyBitmap; |
502 callback.Run(emptyBitmap); | 501 callback.Run(emptyBitmap); |
503 return; | 502 return; |
504 } | 503 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
569 | 568 |
570 void WebTestProxyBase::CapturePixelsAsync( | 569 void WebTestProxyBase::CapturePixelsAsync( |
571 const base::Callback<void(const SkBitmap&)>& callback) { | 570 const base::Callback<void(const SkBitmap&)>& callback) { |
572 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); | 571 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); |
573 | 572 |
574 // It may happen that there is a scheduled animation and | 573 // It may happen that there is a scheduled animation and |
575 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise | 574 // no rootGraphicsLayer yet. If so we would run it right now. Otherwise |
576 // isAcceleratedCompositingActive will return false; | 575 // isAcceleratedCompositingActive will return false; |
577 AnimateNow(); | 576 AnimateNow(); |
578 | 577 |
579 DCHECK(web_widget_->isAcceleratedCompositingActive()); | |
580 DCHECK(!callback.is_null()); | 578 DCHECK(!callback.is_null()); |
581 | 579 |
582 if (test_interfaces_->GetTestRunner()->isPrinting()) { | 580 if (test_interfaces_->GetTestRunner()->isPrinting()) { |
583 base::MessageLoopProxy::current()->PostTask( | 581 base::MessageLoopProxy::current()->PostTask( |
584 FROM_HERE, | 582 FROM_HERE, |
585 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting, | 583 base::Bind(&WebTestProxyBase::CapturePixelsForPrinting, |
586 base::Unretained(this), | 584 base::Unretained(this), |
587 callback)); | 585 callback)); |
588 return; | 586 return; |
589 } | 587 } |
(...skipping 763 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
1353 if (!push_client_.get()) | 1351 if (!push_client_.get()) |
1354 push_client_.reset(new MockWebPushClient); | 1352 push_client_.reset(new MockWebPushClient); |
1355 return push_client_.get(); | 1353 return push_client_.get(); |
1356 } | 1354 } |
1357 | 1355 |
1358 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { | 1356 blink::WebPushClient* WebTestProxyBase::GetWebPushClient() { |
1359 return GetPushClientMock(); | 1357 return GetPushClientMock(); |
1360 } | 1358 } |
1361 | 1359 |
1362 } // namespace content | 1360 } // namespace content |
OLD | NEW |