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

Unified Diff: ui/snapshot/snapshot_aura_unittest.cc

Issue 2592983002: [devtools] Support different encodings for Page.CaptureScreenshot. (Closed)
Patch Set: Wait for load in CaptureScreenshotTest to fix android bot. Created 3 years, 11 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 side-by-side diff with in-line comments
Download patch
Index: ui/snapshot/snapshot_aura_unittest.cc
diff --git a/ui/snapshot/snapshot_aura_unittest.cc b/ui/snapshot/snapshot_aura_unittest.cc
index 7be0d703fa1c2006a3b69d30f9b137db124db89f..e9fc843c1f016b62c5e944cf9033ee5393fe6320 100644
--- a/ui/snapshot/snapshot_aura_unittest.cc
+++ b/ui/snapshot/snapshot_aura_unittest.cc
@@ -140,19 +140,17 @@ class SnapshotAuraTest : public testing::Test {
aura::Window::ConvertRectToTarget(
test_window(), root_window(), &source_rect);
- scoped_refptr<base::TestSimpleTaskRunner> task_runner(
- new base::TestSimpleTaskRunner());
scoped_refptr<SnapshotHolder> holder(new SnapshotHolder);
ui::GrabWindowSnapshotAsync(
root_window(),
source_rect,
- task_runner,
base::Bind(&SnapshotHolder::SnapshotCallback, holder));
// Wait for copy response.
+ // TODO(eseckler): This doesn't actually wait until the copy response is
Eric Seckler 2017/01/09 14:52:05 enne@/sadrul@: These tests are super flaky and don
sadrul 2017/01/10 05:12:50 Ugh, it does look like these tests are not actuall
enne (OOO) 2017/01/10 19:26:04 It sounds likely that this has been broken ever si
Eric Seckler 2017/01/11 15:58:44 OK, thanks! Turns out, there's more failing than
sadrul 2017/01/11 17:16:53 I think the current expectations are correct. Soun
+ // issued, because cc::Display::DrawAndSwap() executes surface draw
+ // callbacks before drawing the frame on the renderer.
WaitForDraw();
- // Run internal snapshot callback to scale/rotate response image.
- task_runner->RunUntilIdle();
// Run SnapshotHolder callback.
helper_->RunAllPendingInMessageLoop();
@@ -169,10 +167,9 @@ class SnapshotAuraTest : public testing::Test {
public:
SnapshotHolder() : completed_(false) {}
- void SnapshotCallback(scoped_refptr<base::RefCountedBytes> png_data) {
+ void SnapshotCallback(const gfx::Image& image) {
DCHECK(!completed_);
- image_ = gfx::Image::CreateFrom1xPNGBytes(&(png_data->data()[0]),
- png_data->size());
+ image_ = image;
completed_ = true;
}
bool completed() const {

Powered by Google App Engine
This is Rietveld 408576698