Drive: Add BatchableRequest subclass.
[chromium-blink-merge.git] / ui / views / controls / native / native_view_host_test_base.h
blob6a39f4d987b1e4c2792fdca63a8afe0c04e8d601
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
3 // found in the LICENSE file.
5 #include "base/macros.h"
6 #include "base/memory/scoped_ptr.h"
7 #include "ui/views/test/views_test_base.h"
9 namespace views {
11 class NativeViewHost;
12 class NativeViewHostWrapper;
13 class Widget;
15 namespace test {
17 // Base class for NativeViewHost tests on different platforms.
18 class NativeViewHostTestBase : public ViewsTestBase {
19 public:
20 NativeViewHostTestBase();
21 ~NativeViewHostTestBase() override;
23 // Create the |toplevel_| widget.
24 void CreateTopLevel();
26 // Create a testing |host_| that tracks destructor calls.
27 void CreateTestingHost();
29 // The number of times a host created by CreateHost() has been destroyed.
30 int host_destroyed_count() { return host_destroyed_count_; }
31 void ResetHostDestroyedCount() { host_destroyed_count_ = 0; }
33 // Create a child widget whose native parent is |native_parent_view|, uses
34 // |contents_view|, and is attached to |host| which is added as a child to
35 // |parent_view|. This effectively borrows the native content view from a
36 // newly created child Widget, and attaches it to |host|.
37 Widget* CreateChildForHost(gfx::NativeView native_parent_view,
38 View* parent_view,
39 View* contents_view,
40 NativeViewHost* host);
42 Widget* toplevel() { return toplevel_.get(); }
43 void DestroyTopLevel();
45 NativeViewHost* host() { return host_.get(); }
46 void DestroyHost();
47 NativeViewHost* ReleaseHost();
49 NativeViewHostWrapper* GetNativeWrapper();
51 private:
52 class NativeViewHostTesting;
54 scoped_ptr<Widget> toplevel_;
55 scoped_ptr<NativeViewHost> host_;
56 int host_destroyed_count_;
58 DISALLOW_COPY_AND_ASSIGN(NativeViewHostTestBase);
61 } // namespace test
62 } // namespace views