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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 2739553005: Moves maintaining root_window_for_new_windows_ to Shell (Closed)
Patch Set: remove ash:: Created 3 years, 9 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 | « ash/drag_drop/drag_drop_tracker_unittest.cc ('k') | ash/magnifier/magnification_controller.cc » ('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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "ash/common/system/tray/system_tray.h" 5 #include "ash/common/system/tray/system_tray.h"
6 #include "ash/common/wm/root_window_finder.h" 6 #include "ash/common/wm/root_window_finder.h"
7 #include "ash/common/wm_window.h" 7 #include "ash/common/wm_window.h"
8 #include "ash/public/cpp/shell_window_ids.h" 8 #include "ash/public/cpp/shell_window_ids.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/shell.h" 10 #include "ash/shell.h"
(...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView())); 217 EXPECT_TRUE(wm::IsActiveWindow(widget_on_2nd->GetNativeView()));
218 } 218 }
219 219
220 TEST_F(ExtendedDesktopTest, SystemModal) { 220 TEST_F(ExtendedDesktopTest, SystemModal) {
221 UpdateDisplay("1000x600,600x400"); 221 UpdateDisplay("1000x600,600x400");
222 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 222 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
223 223
224 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100)); 224 views::Widget* widget_on_1st = CreateTestWidget(gfx::Rect(10, 10, 100, 100));
225 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 225 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
226 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow()); 226 EXPECT_EQ(root_windows[0], widget_on_1st->GetNativeView()->GetRootWindow());
227 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); 227 EXPECT_EQ(root_windows[0], Shell::GetRootWindowForNewWindows());
228 228
229 // Open system modal. Make sure it's on 2nd root window and active. 229 // Open system modal. Make sure it's on 2nd root window and active.
230 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds( 230 views::Widget* modal_widget = views::Widget::CreateWindowWithContextAndBounds(
231 new ModalWidgetDelegate(), CurrentContext(), 231 new ModalWidgetDelegate(), CurrentContext(),
232 gfx::Rect(1200, 100, 100, 100)); 232 gfx::Rect(1200, 100, 100, 100));
233 modal_widget->Show(); 233 modal_widget->Show();
234 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 234 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
235 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow()); 235 EXPECT_EQ(root_windows[1], modal_widget->GetNativeView()->GetRootWindow());
236 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); 236 EXPECT_EQ(root_windows[1], Shell::GetRootWindowForNewWindows());
237 237
238 ui::test::EventGenerator& event_generator(GetEventGenerator()); 238 ui::test::EventGenerator& event_generator(GetEventGenerator());
239 239
240 // Clicking a widget on widget_on_1st display should not change activation. 240 // Clicking a widget on widget_on_1st display should not change activation.
241 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 241 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
242 event_generator.ClickLeftButton(); 242 event_generator.ClickLeftButton();
243 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView())); 243 EXPECT_TRUE(wm::IsActiveWindow(modal_widget->GetNativeView()));
244 EXPECT_EQ(root_windows[1], Shell::GetTargetRootWindow()); 244 EXPECT_EQ(root_windows[1], Shell::GetRootWindowForNewWindows());
245 245
246 // Close system modal and so clicking a widget should work now. 246 // Close system modal and so clicking a widget should work now.
247 modal_widget->Close(); 247 modal_widget->Close();
248 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView()); 248 event_generator.MoveMouseToCenterOf(widget_on_1st->GetNativeView());
249 event_generator.ClickLeftButton(); 249 event_generator.ClickLeftButton();
250 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView())); 250 EXPECT_TRUE(wm::IsActiveWindow(widget_on_1st->GetNativeView()));
251 EXPECT_EQ(root_windows[0], Shell::GetTargetRootWindow()); 251 EXPECT_EQ(root_windows[0], Shell::GetRootWindowForNewWindows());
252 } 252 }
253 253
254 TEST_F(ExtendedDesktopTest, TestCursor) { 254 TEST_F(ExtendedDesktopTest, TestCursor) {
255 UpdateDisplay("1000x600,600x400"); 255 UpdateDisplay("1000x600,600x400");
256 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 256 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
257 aura::WindowTreeHost* host0 = root_windows[0]->GetHost(); 257 aura::WindowTreeHost* host0 = root_windows[0]->GetHost();
258 aura::WindowTreeHost* host1 = root_windows[1]->GetHost(); 258 aura::WindowTreeHost* host1 = root_windows[1]->GetHost();
259 EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type()); 259 EXPECT_EQ(ui::kCursorPointer, host0->last_cursor().native_type());
260 EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type()); 260 EXPECT_EQ(ui::kCursorNull, host1->last_cursor().native_type());
261 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy); 261 Shell::GetInstance()->cursor_manager()->SetCursor(ui::kCursorCopy);
(...skipping 591 matching lines...) Expand 10 before | Expand all | Expand 10 after
853 generator.ReleaseLeftButton(); 853 generator.ReleaseLeftButton();
854 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset()); 854 EXPECT_EQ("-999,-999 -999,-999", event_handler.GetLocationsAndReset());
855 855
856 generator.MoveMouseTo(400, 150); 856 generator.MoveMouseTo(400, 150);
857 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset()); 857 EXPECT_EQ("100,150 100,150", event_handler.GetLocationsAndReset());
858 858
859 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler); 859 ash::Shell::GetInstance()->RemovePreTargetHandler(&event_handler);
860 } 860 }
861 861
862 } // namespace ash 862 } // namespace ash
OLDNEW
« no previous file with comments | « ash/drag_drop/drag_drop_tracker_unittest.cc ('k') | ash/magnifier/magnification_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698