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

Side by Side Diff: ui/views/test/platform_test_helper.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
« no previous file with comments | « ui/views/test/platform_test_helper.h ('k') | ui/views/test/platform_test_helper_cocoa.mm » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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/platform_test_helper.h" 5 #include "ui/views/test/platform_test_helper.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/logging.h" 8 #include "base/logging.h"
9 #include "base/memory/ptr_util.h" 9 #include "base/memory/ptr_util.h"
10 #include "ui/views/widget/widget.h"
11
12 #if defined(USE_AURA)
13 #include "ui/aura/window.h"
14 #endif
10 15
11 namespace views { 16 namespace views {
12 namespace { 17 namespace {
13 18
14 class DefaultPlatformTestHelper : public PlatformTestHelper {
15 public:
16 DefaultPlatformTestHelper() {}
17
18 ~DefaultPlatformTestHelper() override {}
19
20 private:
21 DISALLOW_COPY_AND_ASSIGN(DefaultPlatformTestHelper);
22 };
23
24 PlatformTestHelper::Factory test_helper_factory; 19 PlatformTestHelper::Factory test_helper_factory;
25 bool is_mus = false; 20 bool is_mus = false;
26 bool is_aura_mus_client = false; 21 bool is_aura_mus_client = false;
27 22
28 } // namespace 23 } // namespace
29 24
30 void PlatformTestHelper::set_factory(const Factory& factory) { 25 void PlatformTestHelper::set_factory(const Factory& factory) {
31 DCHECK(test_helper_factory.is_null()); 26 DCHECK(test_helper_factory.is_null());
32 test_helper_factory = factory; 27 test_helper_factory = factory;
33 } 28 }
34 29
35 // static 30 // static
36 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() { 31 std::unique_ptr<PlatformTestHelper> PlatformTestHelper::Create() {
37 return !test_helper_factory.is_null() 32 return !test_helper_factory.is_null()
38 ? test_helper_factory.Run() 33 ? test_helper_factory.Run()
39 : base::WrapUnique(new DefaultPlatformTestHelper); 34 : base::WrapUnique(new PlatformTestHelper);
40 } 35 }
41 36
42 // static 37 // static
43 void PlatformTestHelper::SetIsMus() { 38 void PlatformTestHelper::SetIsMus() {
44 is_mus = true; 39 is_mus = true;
45 } 40 }
46 41
47 // static 42 // static
48 bool PlatformTestHelper::IsMus() { 43 bool PlatformTestHelper::IsMus() {
49 return is_mus; 44 return is_mus;
50 } 45 }
51 46
52 // static 47 // static
53 void PlatformTestHelper::SetIsAuraMusClient() { 48 void PlatformTestHelper::SetIsAuraMusClient() {
54 is_aura_mus_client = true; 49 is_aura_mus_client = true;
55 } 50 }
56 51
57 // static 52 // static
58 bool PlatformTestHelper::IsAuraMusClient() { 53 bool PlatformTestHelper::IsAuraMusClient() {
59 return is_aura_mus_client; 54 return is_aura_mus_client;
60 } 55 }
61 56
57 #if defined(USE_AURA)
58 void PlatformTestHelper::SimulateNativeDestroy(Widget* widget) {
59 delete widget->GetNativeView();
60 }
61 #endif
62
62 } // namespace views 63 } // namespace views
OLDNEW
« no previous file with comments | « ui/views/test/platform_test_helper.h ('k') | ui/views/test/platform_test_helper_cocoa.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698