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

Unified Diff: blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc

Issue 2320923002: Add a full Blimp integration test. (Closed)
Patch Set: Fix build break with chrome embedder Created 4 years, 3 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: blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc
diff --git a/blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc b/blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc
new file mode 100644
index 0000000000000000000000000000000000000000..051909e2b5fefdf5b6ad7e7c5e0fee7ef914f559
--- /dev/null
+++ b/blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc
@@ -0,0 +1,35 @@
+// Copyright 2016 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "blimp/engine/browser_tests/blimp_contents_view_readback_helper.h"
+
+#include "base/bind.h"
+#include "third_party/skia/include/core/SkBitmap.h"
+
+namespace blimp {
+
+BlimpContentsViewReadbackHelper::BlimpContentsViewReadbackHelper()
+ : event_(base::WaitableEvent::ResetPolicy::MANUAL,
+ base::WaitableEvent::InitialState::NOT_SIGNALED),
+ weak_ptr_factory_(this) {}
+
+BlimpContentsViewReadbackHelper::~BlimpContentsViewReadbackHelper() = default;
+
+client::BlimpContentsView::ReadbackRequestCallback
+BlimpContentsViewReadbackHelper::GetCallback() {
+ return base::Bind(&BlimpContentsViewReadbackHelper::OnReadbackComplete,
+ weak_ptr_factory_.GetWeakPtr());
+}
+
+SkBitmap* BlimpContentsViewReadbackHelper::GetBitmap() const {
+ return bitmap_.get();
+}
+
+void BlimpContentsViewReadbackHelper::OnReadbackComplete(
+ std::unique_ptr<SkBitmap> bitmap) {
+ bitmap_ = std::move(bitmap);
+ event_.Signal();
+}
+
+} // namespace blimp
« no previous file with comments | « blimp/engine/browser_tests/blimp_contents_view_readback_helper.h ('k') | blimp/engine/browser_tests/integration_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698