Add ICU message format support
[chromium-blink-merge.git] / ui / views / controls / native / native_view_host_test_base.h
blobf663956da6179e68be859bb5a03dee9b707dfdd1
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 // testing::Test:
24 void TearDown() override;
26 // Create the |toplevel_| widget.
27 void CreateTopLevel();
29 // Create a testing |host_| that tracks destructor calls.
30 void CreateTestingHost();
32 // The number of times a host created by CreateHost() has been destroyed.
33 int host_destroyed_count() { return host_destroyed_count_; }
34 void ResetHostDestroyedCount() { host_destroyed_count_ = 0; }
36 // Create a child widget whose native parent is |native_parent_view|, uses
37 // |contents_view|, and is attached to |host| which is added as a child to
38 // |parent_view|. This effectively borrows the native content view from a
39 // newly created child Widget, and attaches it to |host|.
40 Widget* CreateChildForHost(gfx::NativeView native_parent_view,
41 View* parent_view,
42 View* contents_view,
43 NativeViewHost* host);
45 Widget* toplevel() { return toplevel_.get(); }
46 void DestroyTopLevel();
48 NativeViewHost* host() { return host_.get(); }
49 void DestroyHost();
50 NativeViewHost* ReleaseHost();
52 NativeViewHostWrapper* GetNativeWrapper();
54 private:
55 class NativeViewHostTesting;
57 scoped_ptr<Widget> toplevel_;
58 scoped_ptr<NativeViewHost> host_;
59 int host_destroyed_count_;
61 DISALLOW_COPY_AND_ASSIGN(NativeViewHostTestBase);
64 } // namespace test
65 } // namespace views