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

Side by Side Diff: ash/wm/solo_window_tracker_unittest.cc

Issue 138003007: [Cleanup] Screen cleanup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: make sure screen_for_shutdown is reset everytime Created 6 years, 11 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/panels/panel_window_resizer.cc ('k') | ash/wm/window_animations.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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 "ash/wm/solo_window_tracker.h" 5 #include "ash/wm/solo_window_tracker.h"
6 6
7 #include "ash/ash_constants.h" 7 #include "ash/ash_constants.h"
8 #include "ash/ash_switches.h" 8 #include "ash/ash_switches.h"
9 #include "ash/root_window_controller.h" 9 #include "ash/root_window_controller.h"
10 #include "ash/screen_ash.h" 10 #include "ash/screen_ash.h"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
96 window->SetBounds(gfx::Rect(100, 100)); 96 window->SetBounds(gfx::Rect(100, 100));
97 ParentWindowInPrimaryRootWindow(window); 97 ParentWindowInPrimaryRootWindow(window);
98 return window; 98 return window;
99 } 99 }
100 100
101 // Drag |window| to the dock. 101 // Drag |window| to the dock.
102 void DockWindow(aura::Window* window) { 102 void DockWindow(aura::Window* window) {
103 // Because the tests use windows without delegates, 103 // Because the tests use windows without delegates,
104 // aura::test::EventGenerator cannot be used. 104 // aura::test::EventGenerator cannot be used.
105 gfx::Point drag_to = 105 gfx::Point drag_to =
106 ash::ScreenAsh::GetDisplayBoundsInParent(window).top_right(); 106 ash::ScreenUtil::GetDisplayBoundsInParent(window).top_right();
107 scoped_ptr<WindowResizer> resizer(CreateWindowResizer( 107 scoped_ptr<WindowResizer> resizer(CreateWindowResizer(
108 window, 108 window,
109 window->bounds().origin(), 109 window->bounds().origin(),
110 HTCAPTION, 110 HTCAPTION,
111 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 111 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
112 resizer->Drag(drag_to, 0); 112 resizer->Drag(drag_to, 0);
113 resizer->CompleteDrag(); 113 resizer->CompleteDrag();
114 EXPECT_EQ(internal::kShellWindowId_DockedContainer, 114 EXPECT_EQ(internal::kShellWindowId_DockedContainer,
115 window->parent()->id()); 115 window->parent()->id());
116 } 116 }
117 117
118 // Drag |window| out of the dock. 118 // Drag |window| out of the dock.
119 void UndockWindow(aura::Window* window) { 119 void UndockWindow(aura::Window* window) {
120 gfx::Point drag_to = 120 gfx::Point drag_to =
121 ash::ScreenAsh::GetDisplayWorkAreaBoundsInParent(window).top_right() - 121 ash::ScreenUtil::GetDisplayWorkAreaBoundsInParent(window).top_right() -
122 gfx::Vector2d(10, 0); 122 gfx::Vector2d(10, 0);
123 scoped_ptr<WindowResizer> resizer(CreateWindowResizer( 123 scoped_ptr<WindowResizer> resizer(CreateWindowResizer(
124 window, 124 window,
125 window->bounds().origin(), 125 window->bounds().origin(),
126 HTCAPTION, 126 HTCAPTION,
127 aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 127 aura::client::WINDOW_MOVE_SOURCE_MOUSE));
128 resizer->Drag(drag_to, 0); 128 resizer->Drag(drag_to, 0);
129 resizer->CompleteDrag(); 129 resizer->CompleteDrag();
130 EXPECT_NE(internal::kShellWindowId_DockedContainer, 130 EXPECT_NE(internal::kShellWindowId_DockedContainer,
131 window->parent()->id()); 131 window->parent()->id());
132 } 132 }
133 133
134 // Returns the primary display. 134 // Returns the primary display.
135 gfx::Display GetPrimaryDisplay() { 135 gfx::Display GetPrimaryDisplay() {
136 return ash::Shell::GetInstance()->GetScreen()->GetPrimaryDisplay(); 136 return ash::Shell::GetInstance()->GetScreen()->GetPrimaryDisplay();
137 } 137 }
138 138
139 // Returns the secondary display. 139 // Returns the secondary display.
140 gfx::Display GetSecondaryDisplay() { 140 gfx::Display GetSecondaryDisplay() {
141 return ScreenAsh::GetSecondaryDisplay(); 141 return ScreenUtil::GetSecondaryDisplay();
142 } 142 }
143 143
144 // Returns the window which uses the solo header, if any, on the primary 144 // Returns the window which uses the solo header, if any, on the primary
145 // display. 145 // display.
146 aura::Window* GetWindowWithSoloHeaderInPrimary() { 146 aura::Window* GetWindowWithSoloHeaderInPrimary() {
147 return GetWindowWithSoloHeader(Shell::GetPrimaryRootWindow()); 147 return GetWindowWithSoloHeader(Shell::GetPrimaryRootWindow());
148 } 148 }
149 149
150 // Returns the window which uses the solo header, if any, in |root|. 150 // Returns the window which uses the solo header, if any, in |root|.
151 aura::Window* GetWindowWithSoloHeader(aura::Window* root) { 151 aura::Window* GetWindowWithSoloHeader(aura::Window* root) {
(...skipping 170 matching lines...) Expand 10 before | Expand all | Expand 10 after
322 WindowRepaintChecker checker2(w2.get()); 322 WindowRepaintChecker checker2(w2.get());
323 323
324 // Now there are two windows in the same display, so we should not use solo 324 // Now there are two windows in the same display, so we should not use solo
325 // headers. 325 // headers.
326 EXPECT_EQ(NULL, GetWindowWithSoloHeaderInPrimary()); 326 EXPECT_EQ(NULL, GetWindowWithSoloHeaderInPrimary());
327 EXPECT_TRUE(checker1.IsPaintScheduledAndReset()); 327 EXPECT_TRUE(checker1.IsPaintScheduledAndReset());
328 328
329 // Moves the second window to the secondary display. Both w1/w2 should be 329 // Moves the second window to the secondary display. Both w1/w2 should be
330 // solo. 330 // solo.
331 w2->SetBoundsInScreen(gfx::Rect(1200, 0, 100, 100), 331 w2->SetBoundsInScreen(gfx::Rect(1200, 0, 100, 100),
332 ScreenAsh::GetSecondaryDisplay()); 332 ScreenUtil::GetSecondaryDisplay());
333 EXPECT_EQ(w1.get(), GetWindowWithSoloHeaderInPrimary()); 333 EXPECT_EQ(w1.get(), GetWindowWithSoloHeaderInPrimary());
334 EXPECT_EQ(w2.get(), GetWindowWithSoloHeader(w2->GetRootWindow())); 334 EXPECT_EQ(w2.get(), GetWindowWithSoloHeader(w2->GetRootWindow()));
335 EXPECT_TRUE(checker1.IsPaintScheduledAndReset()); 335 EXPECT_TRUE(checker1.IsPaintScheduledAndReset());
336 EXPECT_TRUE(checker2.IsPaintScheduledAndReset()); 336 EXPECT_TRUE(checker2.IsPaintScheduledAndReset());
337 337
338 // Open two more windows in the primary display. 338 // Open two more windows in the primary display.
339 scoped_ptr<aura::Window> w3(CreateWindowInPrimary()); 339 scoped_ptr<aura::Window> w3(CreateWindowInPrimary());
340 w3->SetBoundsInScreen(gfx::Rect(0, 0, 100, 100), GetPrimaryDisplay()); 340 w3->SetBoundsInScreen(gfx::Rect(0, 0, 100, 100), GetPrimaryDisplay());
341 w3->Show(); 341 w3->Show();
342 scoped_ptr<aura::Window> w4(CreateWindowInPrimary()); 342 scoped_ptr<aura::Window> w4(CreateWindowInPrimary());
(...skipping 77 matching lines...) Expand 10 before | Expand all | Expand 10 after
420 w.reset(); 420 w.reset();
421 EXPECT_EQ(NULL, GetWindowWithSoloHeaderInPrimary()); 421 EXPECT_EQ(NULL, GetWindowWithSoloHeaderInPrimary());
422 422
423 // Recreate another window again. 423 // Recreate another window again.
424 w.reset(CreateWindowInPrimary()); 424 w.reset(CreateWindowInPrimary());
425 w->Show(); 425 w->Show();
426 EXPECT_EQ(w.get(), GetWindowWithSoloHeaderInPrimary()); 426 EXPECT_EQ(w.get(), GetWindowWithSoloHeaderInPrimary());
427 } 427 }
428 428
429 } // namespace ash 429 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/panels/panel_window_resizer.cc ('k') | ash/wm/window_animations.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698