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

Unified Diff: ui/views/controls/native/native_view_host_test_base.h

Issue 530933002: MacViews: Implement NativeViewHostMac (take 3) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Back to the "real" patch Created 6 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: ui/views/controls/native/native_view_host_test_base.h
diff --git a/ui/views/controls/native/native_view_host_test_base.h b/ui/views/controls/native/native_view_host_test_base.h
new file mode 100644
index 0000000000000000000000000000000000000000..ce98fb46e6642247dc02034635c6cd72f19d6819
--- /dev/null
+++ b/ui/views/controls/native/native_view_host_test_base.h
@@ -0,0 +1,62 @@
+// Copyright 2014 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 "base/macros.h"
+#include "base/memory/scoped_ptr.h"
+#include "ui/views/test/views_test_base.h"
+
+namespace views {
+
+class NativeViewHost;
+class NativeViewHostWrapper;
+class Widget;
+
+namespace test {
+
+// Base class for NativeViewHost tests on different platforms.
+class NativeViewHostTestBase : public ViewsTestBase {
+ public:
+ NativeViewHostTestBase();
+ virtual ~NativeViewHostTestBase();
+
+ // Create the |toplevel_| widget.
+ void CreateTopLevel();
+
+ // Create a testing |host_| that tracks destructor calls.
+ void CreateTestingHost();
+
+ // The number of times a host created by CreateHost() has been destroyed.
+ int host_destroyed_count() { return host_destroyed_count_; }
+ void ResetHostDestroyedCount() { host_destroyed_count_ = 0; }
+
+ // Create a child widget whose native parent is |native_parent_view|, uses
+ // |contents_view|, and is attached to |host| which is added as a child to
+ // |parent_view|. This effectively borrows the native content view from a
+ // newly created child Widget, and attaches it to |host|.
+ Widget* CreateChildForHost(gfx::NativeView native_parent_view,
+ View* parent_view,
+ View* contents_view,
+ NativeViewHost* host);
+
+ Widget* toplevel() { return toplevel_.get(); }
+ void DestroyTopLevel();
+
+ NativeViewHost* host() { return host_.get(); }
+ void DestroyHost();
+ NativeViewHost* ReleaseHost();
+
+ NativeViewHostWrapper* GetNativeWrapper();
+
+ private:
+ class NativeViewHostTesting;
+
+ scoped_ptr<Widget> toplevel_;
+ scoped_ptr<NativeViewHost> host_;
+ int host_destroyed_count_;
+
+ DISALLOW_COPY_AND_ASSIGN(NativeViewHostTestBase);
+};
+
+} // namespace test
+} // namespace views

Powered by Google App Engine
This is Rietveld 408576698