OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/bind.h" | 6 #include "base/bind.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "ui/gfx/native_widget_types.h" | 8 #include "ui/gfx/native_widget_types.h" |
9 #include "ui/views/test/widget_test.h" | 9 #include "ui/views/test/widget_test.h" |
10 #include "ui/views/widget/widget.h" | 10 #include "ui/views/widget/widget.h" |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 Widget::InitParams init_params2 = | 187 Widget::InitParams init_params2 = |
188 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); | 188 CreateParams(Widget::InitParams::TYPE_WINDOW_FRAMELESS); |
189 init_params2.bounds = gfx::Rect(0, 0, 200, 200); | 189 init_params2.bounds = gfx::Rect(0, 0, 200, 200); |
190 init_params2.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; | 190 init_params2.ownership = Widget::InitParams::WIDGET_OWNS_NATIVE_WIDGET; |
191 init_params2.native_widget = new DesktopNativeWidgetAura(&widget2); | 191 init_params2.native_widget = new DesktopNativeWidgetAura(&widget2); |
192 widget2.Init(init_params2); | 192 widget2.Init(init_params2); |
193 widget2.SetContentsView(contents_view2); | 193 widget2.SetContentsView(contents_view2); |
194 widget2.Show(); | 194 widget2.Show(); |
195 aura::Window* root_window2 = widget2.GetNativeView()->GetRootWindow(); | 195 aura::Window* root_window2 = widget2.GetNativeView()->GetRootWindow(); |
196 contents_view2->RequestFocus(); | 196 contents_view2->RequestFocus(); |
197 ::SetActiveWindow(root_window2->GetDispatcher()->GetAcceleratedWidget()); | 197 ::SetActiveWindow( |
| 198 root_window2->GetDispatcher()->host()->GetAcceleratedWidget()); |
198 | 199 |
199 aura::client::ActivationClient* activation_client2 = | 200 aura::client::ActivationClient* activation_client2 = |
200 aura::client::GetActivationClient(root_window2); | 201 aura::client::GetActivationClient(root_window2); |
201 EXPECT_TRUE(activation_client2 != NULL); | 202 EXPECT_TRUE(activation_client2 != NULL); |
202 EXPECT_EQ(activation_client2->GetActiveWindow(), widget2.GetNativeView()); | 203 EXPECT_EQ(activation_client2->GetActiveWindow(), widget2.GetNativeView()); |
203 EXPECT_EQ(activation_client1->GetActiveWindow(), | 204 EXPECT_EQ(activation_client1->GetActiveWindow(), |
204 reinterpret_cast<aura::Window*>(NULL)); | 205 reinterpret_cast<aura::Window*>(NULL)); |
205 | 206 |
206 // Now set focus back to widget 1 and expect the active window to be its | 207 // Now set focus back to widget 1 and expect the active window to be its |
207 // window. | 208 // window. |
208 contents_view1->RequestFocus(); | 209 contents_view1->RequestFocus(); |
209 ::SetActiveWindow(root_window1->GetDispatcher()->GetAcceleratedWidget()); | 210 ::SetActiveWindow( |
| 211 root_window1->GetDispatcher()->host()->GetAcceleratedWidget()); |
210 EXPECT_EQ(activation_client2->GetActiveWindow(), | 212 EXPECT_EQ(activation_client2->GetActiveWindow(), |
211 reinterpret_cast<aura::Window*>(NULL)); | 213 reinterpret_cast<aura::Window*>(NULL)); |
212 EXPECT_EQ(activation_client1->GetActiveWindow(), widget1.GetNativeView()); | 214 EXPECT_EQ(activation_client1->GetActiveWindow(), widget1.GetNativeView()); |
213 } | 215 } |
214 #endif | 216 #endif |
215 | 217 |
216 TEST_F(WidgetTest, CaptureAutoReset) { | 218 TEST_F(WidgetTest, CaptureAutoReset) { |
217 Widget* toplevel = CreateTopLevelFramelessPlatformWidget(); | 219 Widget* toplevel = CreateTopLevelFramelessPlatformWidget(); |
218 View* container = new View; | 220 View* container = new View; |
219 toplevel->SetContentsView(container); | 221 toplevel->SetContentsView(container); |
(...skipping 515 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
735 ui::EF_NONE); | 737 ui::EF_NONE); |
736 widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> | 738 widget1.GetNativeWindow()->GetDispatcher()->AsRootWindowHostDelegate()-> |
737 OnHostMouseEvent(&mouse_event); | 739 OnHostMouseEvent(&mouse_event); |
738 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); | 740 EXPECT_TRUE(widget1.GetAndClearGotMouseEvent()); |
739 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); | 741 EXPECT_FALSE(widget2.GetAndClearGotMouseEvent()); |
740 } | 742 } |
741 #endif | 743 #endif |
742 | 744 |
743 } // namespace test | 745 } // namespace test |
744 } // namespace views | 746 } // namespace views |
OLD | NEW |