Chromium Code Reviews| OLD | NEW |
|---|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/WebTestProxy.h" | 5 #include "content/shell/renderer/test_runner/WebTestProxy.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/debug/trace_event.h" | 10 #include "base/debug/trace_event.h" |
| (...skipping 481 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 492 m_compositeAndReadbackCallbacks.front().Run(bitmap); | 492 m_compositeAndReadbackCallbacks.front().Run(bitmap); |
| 493 m_compositeAndReadbackCallbacks.pop_front(); | 493 m_compositeAndReadbackCallbacks.pop_front(); |
| 494 } | 494 } |
| 495 | 495 |
| 496 void WebTestProxyBase::CapturePixelsAsync( | 496 void WebTestProxyBase::CapturePixelsAsync( |
| 497 base::Callback<void(const SkBitmap&)> callback) { | 497 base::Callback<void(const SkBitmap&)> callback) { |
| 498 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); | 498 TRACE_EVENT0("shell", "WebTestProxyBase::CapturePixelsAsync"); |
| 499 | 499 |
| 500 DCHECK(webWidget()->isAcceleratedCompositingActive()); | 500 DCHECK(webWidget()->isAcceleratedCompositingActive()); |
| 501 DCHECK(!callback.is_null()); | 501 DCHECK(!callback.is_null()); |
| 502 | |
| 503 if (m_testInterfaces->testRunner()->isPrinting()) { | |
| 504 // TODO(enne): get rid of stateful canvas(). | |
| 505 webWidget()->layout(); | |
| 506 paintPagesWithBoundaries(); | |
| 507 DrawSelectionRect(canvas()); | |
| 508 SkBaseDevice* device = skia::GetTopDevice(*canvas()); | |
| 509 const SkBitmap& bitmap = device->accessBitmap(false); | |
| 510 callback.Run(bitmap); | |
|
danakj
2014/05/09 21:17:21
do you wanna post-task this to keep it async? othe
enne (OOO)
2014/05/09 21:25:06
It's a nice thought, but it seems awkward to do wi
danakj
2014/05/09 21:37:25
I figured the test harness shouldn't be doing anyt
enne (OOO)
2014/05/09 22:03:20
Done.
| |
| 511 return; | |
| 512 } | |
| 513 | |
| 502 m_compositeAndReadbackCallbacks.push_back(callback); | 514 m_compositeAndReadbackCallbacks.push_back(callback); |
| 503 webWidget()->compositeAndReadbackAsync(this); | 515 webWidget()->compositeAndReadbackAsync(this); |
| 504 } | 516 } |
| 505 | 517 |
| 506 void WebTestProxyBase::setLogConsoleOutput(bool enabled) | 518 void WebTestProxyBase::setLogConsoleOutput(bool enabled) |
| 507 { | 519 { |
| 508 m_logConsoleOutput = enabled; | 520 m_logConsoleOutput = enabled; |
| 509 } | 521 } |
| 510 | 522 |
| 511 void WebTestProxyBase::paintRect(const WebRect& rect) | 523 void WebTestProxyBase::paintRect(const WebRect& rect) |
| (...skipping 800 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 1312 | 1324 |
| 1313 void WebTestProxyBase::resetInputMethod() | 1325 void WebTestProxyBase::resetInputMethod() |
| 1314 { | 1326 { |
| 1315 // If a composition text exists, then we need to let the browser process | 1327 // If a composition text exists, then we need to let the browser process |
| 1316 // to cancel the input method's ongoing composition session. | 1328 // to cancel the input method's ongoing composition session. |
| 1317 if (m_webWidget) | 1329 if (m_webWidget) |
| 1318 m_webWidget->confirmComposition(); | 1330 m_webWidget->confirmComposition(); |
| 1319 } | 1331 } |
| 1320 | 1332 |
| 1321 } // namespace content | 1333 } // namespace content |
| OLD | NEW |