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

Unified Diff: ui/views/test/native_widget_factory_desktop.cc

Issue 2488393003: Changes views_aura_mus_unittests to create DesktopNativeWidgetAura (Closed)
Patch Set: remove this and fix mac Created 4 years, 1 month 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
« no previous file with comments | « ui/views/test/native_widget_factory_aura_mus.cc ('k') | ui/views/test/native_widget_factory_mus.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ui/views/test/native_widget_factory_desktop.cc
diff --git a/ui/views/test/native_widget_factory_desktop.cc b/ui/views/test/native_widget_factory_desktop.cc
index 8129b3ac10ebce4f73a1d55d8e91e35c33de6e3a..1dbe1d3c1f05a248f44c9da3f158c6b1ba8c7290 100644
--- a/ui/views/test/native_widget_factory_desktop.cc
+++ b/ui/views/test/native_widget_factory_desktop.cc
@@ -4,11 +4,11 @@
#include "ui/views/test/native_widget_factory.h"
+#include "ui/views/test/test_platform_native_widget.h"
+
#if defined(USE_AURA)
-#include "ui/views/widget/native_widget_aura.h"
-#if !defined(OS_CHROMEOS)
#include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
-#endif
+#include "ui/views/widget/native_widget_aura.h"
#elif defined(OS_MACOSX)
#include "ui/views/widget/native_widget_mac.h"
#endif
@@ -16,53 +16,38 @@
namespace views {
namespace test {
-#if !defined(OS_CHROMEOS)
-
+NativeWidget* CreatePlatformNativeWidgetImpl(
+ const Widget::InitParams& init_params,
+ Widget* widget,
+ uint32_t type,
+ bool* destroyed) {
#if defined(OS_MACOSX)
-using PlatformDesktopNativeWidget = NativeWidgetMac;
+ return new TestPlatformNativeWidget<NativeWidgetMac>(
+ widget, type == kStubCapture, destroyed);
#else
-using PlatformDesktopNativeWidget = DesktopNativeWidgetAura;
+ return new TestPlatformNativeWidget<NativeWidgetAura>(
+ widget, type == kStubCapture, destroyed);
#endif
-
-namespace {
-
-class TestPlatformDesktopNativeWidget : public PlatformDesktopNativeWidget {
- public:
- TestPlatformDesktopNativeWidget(internal::NativeWidgetDelegate* delegate,
- bool* destroyed);
- ~TestPlatformDesktopNativeWidget() override;
-
- private:
- bool* destroyed_;
-
- DISALLOW_COPY_AND_ASSIGN(TestPlatformDesktopNativeWidget);
-};
-
-// A widget that assumes mouse capture always works. It won't in testing, so we
-// mock it.
-TestPlatformDesktopNativeWidget::TestPlatformDesktopNativeWidget(
- internal::NativeWidgetDelegate* delegate,
- bool* destroyed)
- : PlatformDesktopNativeWidget(delegate), destroyed_(destroyed) {}
-
-TestPlatformDesktopNativeWidget::~TestPlatformDesktopNativeWidget() {
- if (destroyed_)
- *destroyed_ = true;
}
-} // namespace
-
-#endif
-
NativeWidget* CreatePlatformDesktopNativeWidgetImpl(
const Widget::InitParams& init_params,
Widget* widget,
bool* destroyed) {
-#if defined(OS_CHROMEOS)
- // Chromeos only has one NativeWidgetType.
- return CreatePlatformNativeWidgetImpl(init_params, widget, 0u, destroyed);
+#if defined(OS_MACOSX)
+ return new TestPlatformNativeWidget<NativeWidgetMac>(widget, false,
+ destroyed);
+#elif defined(OS_CHROMEOS)
+ // Chromeos only has one NativeWidgetType. Chromeos with aura-mus does not
+ // compile this file.
+ return new TestPlatformNativeWidget<NativeWidgetAura>(widget, false,
+ destroyed);
+#elif defined(USE_AURA)
+ return new TestPlatformNativeWidget<DesktopNativeWidgetAura>(widget, false,
+ destroyed);
#else
- return new TestPlatformDesktopNativeWidget(widget, destroyed);
+ NOTREACHED();
+ return nullptr;
#endif
}
« no previous file with comments | « ui/views/test/native_widget_factory_aura_mus.cc ('k') | ui/views/test/native_widget_factory_mus.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698