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

Side by Side 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 unified diff | Download patch
OLDNEW
1 // Copyright 2016 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "ui/views/test/native_widget_factory.h" 5 #include "ui/views/test/native_widget_factory.h"
6 6
7 #include "ui/views/test/test_platform_native_widget.h"
8
7 #if defined(USE_AURA) 9 #if defined(USE_AURA)
10 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
8 #include "ui/views/widget/native_widget_aura.h" 11 #include "ui/views/widget/native_widget_aura.h"
9 #if !defined(OS_CHROMEOS)
10 #include "ui/views/widget/desktop_aura/desktop_native_widget_aura.h"
11 #endif
12 #elif defined(OS_MACOSX) 12 #elif defined(OS_MACOSX)
13 #include "ui/views/widget/native_widget_mac.h" 13 #include "ui/views/widget/native_widget_mac.h"
14 #endif 14 #endif
15 15
16 namespace views { 16 namespace views {
17 namespace test { 17 namespace test {
18 18
19 #if !defined(OS_CHROMEOS) 19 NativeWidget* CreatePlatformNativeWidgetImpl(
20 20 const Widget::InitParams& init_params,
21 Widget* widget,
22 uint32_t type,
23 bool* destroyed) {
21 #if defined(OS_MACOSX) 24 #if defined(OS_MACOSX)
22 using PlatformDesktopNativeWidget = NativeWidgetMac; 25 return new TestPlatformNativeWidget<NativeWidgetMac>(
26 widget, type == kStubCapture, destroyed);
23 #else 27 #else
24 using PlatformDesktopNativeWidget = DesktopNativeWidgetAura; 28 return new TestPlatformNativeWidget<NativeWidgetAura>(
29 widget, type == kStubCapture, destroyed);
25 #endif 30 #endif
26
27 namespace {
28
29 class TestPlatformDesktopNativeWidget : public PlatformDesktopNativeWidget {
30 public:
31 TestPlatformDesktopNativeWidget(internal::NativeWidgetDelegate* delegate,
32 bool* destroyed);
33 ~TestPlatformDesktopNativeWidget() override;
34
35 private:
36 bool* destroyed_;
37
38 DISALLOW_COPY_AND_ASSIGN(TestPlatformDesktopNativeWidget);
39 };
40
41 // A widget that assumes mouse capture always works. It won't in testing, so we
42 // mock it.
43 TestPlatformDesktopNativeWidget::TestPlatformDesktopNativeWidget(
44 internal::NativeWidgetDelegate* delegate,
45 bool* destroyed)
46 : PlatformDesktopNativeWidget(delegate), destroyed_(destroyed) {}
47
48 TestPlatformDesktopNativeWidget::~TestPlatformDesktopNativeWidget() {
49 if (destroyed_)
50 *destroyed_ = true;
51 } 31 }
52 32
53 } // namespace
54
55 #endif
56
57 NativeWidget* CreatePlatformDesktopNativeWidgetImpl( 33 NativeWidget* CreatePlatformDesktopNativeWidgetImpl(
58 const Widget::InitParams& init_params, 34 const Widget::InitParams& init_params,
59 Widget* widget, 35 Widget* widget,
60 bool* destroyed) { 36 bool* destroyed) {
61 #if defined(OS_CHROMEOS) 37 #if defined(OS_MACOSX)
62 // Chromeos only has one NativeWidgetType. 38 return new TestPlatformNativeWidget<NativeWidgetMac>(widget, false,
63 return CreatePlatformNativeWidgetImpl(init_params, widget, 0u, destroyed); 39 destroyed);
40 #elif defined(OS_CHROMEOS)
41 // Chromeos only has one NativeWidgetType. Chromeos with aura-mus does not
42 // compile this file.
43 return new TestPlatformNativeWidget<NativeWidgetAura>(widget, false,
44 destroyed);
45 #elif defined(USE_AURA)
46 return new TestPlatformNativeWidget<DesktopNativeWidgetAura>(widget, false,
47 destroyed);
64 #else 48 #else
65 return new TestPlatformDesktopNativeWidget(widget, destroyed); 49 NOTREACHED();
50 return nullptr;
66 #endif 51 #endif
67 } 52 }
68 53
69 } // namespace test 54 } // namespace test
70 } // namespace views 55 } // namespace views
OLDNEW
« 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