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

Side by Side Diff: blimp/engine/browser_tests/blimp_contents_view_readback_helper.h

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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2016 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef BLIMP_ENGINE_BROWSER_TESTS_BLIMP_CONTENTS_VIEW_READBACK_HELPER_H_
6 #define BLIMP_ENGINE_BROWSER_TESTS_BLIMP_CONTENTS_VIEW_READBACK_HELPER_H_
7
8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h"
10 #include "base/synchronization/waitable_event.h"
11 #include "blimp/client/public/contents/blimp_contents_view.h"
12
13 namespace blimp {
14
15 // A helper class to make grabbing a bitmap from a BlimpContentsView easier.
16 // This can be used in conjunction with a WaitableContentPump to pause test
17 // execution while waiting for the readback to finish. An example use would be:
18 //
19 // WaitableContentPump pump;
20 // BlimpContentsViewReadbackHelper helper;
21 // blimp_contents->GetView()->CopyCompositingSurface(
22 // helper.GetCallback(), true);
23 // pump.WaitFor(helper.event());
24 // helper.bitmap();
25
26 class BlimpContentsViewReadbackHelper {
27 public:
28 BlimpContentsViewReadbackHelper();
29 virtual ~BlimpContentsViewReadbackHelper();
30
31 client::BlimpContentsView::ReadbackRequestCallback GetCallback();
32 SkBitmap* GetBitmap() const;
33
34 base::WaitableEvent* event() { return &event_; }
35
36 private:
37 void OnReadbackComplete(std::unique_ptr<SkBitmap> bitmap);
38
39 base::WaitableEvent event_;
40 std::unique_ptr<SkBitmap> bitmap_;
41
42 base::WeakPtrFactory<BlimpContentsViewReadbackHelper> weak_ptr_factory_;
43
44 DISALLOW_COPY_AND_ASSIGN(BlimpContentsViewReadbackHelper);
45 };
46
47 } // namespace blimp
48
49 #endif // BLIMP_ENGINE_BROWSER_TESTS_BLIMP_CONTENTS_VIEW_READBACK_HELPER_H_
OLDNEW
« no previous file with comments | « blimp/engine/browser_tests/blimp_browser_test.cc ('k') | blimp/engine/browser_tests/blimp_contents_view_readback_helper.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698