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

Side by Side Diff: ui/views/mus/window_tree_host_mus.cc

Issue 2409053002: mash: Use null AcceleratedWidget for widgets in tests (Closed)
Patch Set: . Created 4 years, 2 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 unified diff | Download patch
« no previous file with comments | « mash/test/mash_test_suite.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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/mus/window_tree_host_mus.h" 5 #include "ui/views/mus/window_tree_host_mus.h"
6 6
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "services/ui/public/cpp/window.h" 8 #include "services/ui/public/cpp/window.h"
9 #include "ui/aura/env.h"
9 #include "ui/aura/window.h" 10 #include "ui/aura/window.h"
10 #include "ui/aura/window_event_dispatcher.h" 11 #include "ui/aura/window_event_dispatcher.h"
11 #include "ui/events/event.h" 12 #include "ui/events/event.h"
12 #include "ui/platform_window/stub/stub_window.h" 13 #include "ui/platform_window/stub/stub_window.h"
13 #include "ui/views/mus/input_method_mus.h" 14 #include "ui/views/mus/input_method_mus.h"
14 #include "ui/views/mus/native_widget_mus.h" 15 #include "ui/views/mus/native_widget_mus.h"
15 16
16 namespace views { 17 namespace views {
17 18
18 namespace { 19 namespace {
19 static uint32_t accelerated_widget_count = 1; 20 static uint32_t accelerated_widget_count = 1;
21
22 bool IsUsingTestContext() {
23 return aura::Env::GetInstance()->context_factory()->DoesCreateTestContexts();
24 }
25
20 } 26 }
21 27
22 //////////////////////////////////////////////////////////////////////////////// 28 ////////////////////////////////////////////////////////////////////////////////
23 // WindowTreeHostMus, public: 29 // WindowTreeHostMus, public:
24 30
25 WindowTreeHostMus::WindowTreeHostMus(NativeWidgetMus* native_widget, 31 WindowTreeHostMus::WindowTreeHostMus(NativeWidgetMus* native_widget,
26 ui::Window* window) 32 ui::Window* window)
27 : native_widget_(native_widget) { 33 : native_widget_(native_widget) {
28 // We need accelerated widget numbers to be different for each 34 gfx::AcceleratedWidget accelerated_widget;
29 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t 35 if (IsUsingTestContext()) {
30 // has this property. 36 accelerated_widget = gfx::kNullAcceleratedWidget;
37 } else {
38 // We need accelerated widget numbers to be different for each
39 // window and fit in the smallest sizeof(AcceleratedWidget) uint32_t
40 // has this property.
31 #if defined(OS_WIN) || defined(OS_ANDROID) 41 #if defined(OS_WIN) || defined(OS_ANDROID)
32 gfx::AcceleratedWidget accelerated_widget = 42 accelerated_widget =
33 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); 43 reinterpret_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
34 #else 44 #else
35 gfx::AcceleratedWidget accelerated_widget = 45 accelerated_widget =
36 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++); 46 static_cast<gfx::AcceleratedWidget>(accelerated_widget_count++);
37 #endif 47 #endif
48 }
38 // TODO(markdittmer): Use correct device-scale-factor from |window|. 49 // TODO(markdittmer): Use correct device-scale-factor from |window|.
39 OnAcceleratedWidgetAvailable(accelerated_widget, 1.f); 50 OnAcceleratedWidgetAvailable(accelerated_widget, 1.f);
40 51
41 SetPlatformWindow(base::MakeUnique<ui::StubWindow>( 52 SetPlatformWindow(base::MakeUnique<ui::StubWindow>(
42 this, 53 this,
43 false)); // Do not advertise accelerated widget; already set manually. 54 false)); // Do not advertise accelerated widget; already set manually.
44 55
45 compositor()->SetWindow(window); 56 compositor()->SetWindow(window);
46 57
47 // Initialize the stub platform window bounds to those of the ui::Window. 58 // Initialize the stub platform window bounds to those of the ui::Window.
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after
93 void WindowTreeHostMus::OnCloseRequest() { 104 void WindowTreeHostMus::OnCloseRequest() {
94 OnHostCloseRequested(); 105 OnHostCloseRequested();
95 } 106 }
96 107
97 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() { 108 gfx::ICCProfile WindowTreeHostMus::GetICCProfileForCurrentDisplay() {
98 // TODO: This should read the profile from mus. crbug.com/647510 109 // TODO: This should read the profile from mus. crbug.com/647510
99 return gfx::ICCProfile(); 110 return gfx::ICCProfile();
100 } 111 }
101 112
102 } // namespace views 113 } // namespace views
OLDNEW
« no previous file with comments | « mash/test/mash_test_suite.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698