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

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

Issue 115153002: wm: public window_types. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: ozone deps Created 7 years 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/solo_window_tracker.cc ('k') | ash/wm/stacking_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 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 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
67 class SoloWindowTrackerTest : public test::AshTestBase { 67 class SoloWindowTrackerTest : public test::AshTestBase {
68 public: 68 public:
69 SoloWindowTrackerTest() { 69 SoloWindowTrackerTest() {
70 } 70 }
71 virtual ~SoloWindowTrackerTest() { 71 virtual ~SoloWindowTrackerTest() {
72 } 72 }
73 73
74 // Helpers methods to create test windows in the primary root window. 74 // Helpers methods to create test windows in the primary root window.
75 aura::Window* CreateWindowInPrimary() { 75 aura::Window* CreateWindowInPrimary() {
76 aura::Window* window = new aura::Window(NULL); 76 aura::Window* window = new aura::Window(NULL);
77 window->SetType(aura::client::WINDOW_TYPE_NORMAL); 77 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
78 window->Init(ui::LAYER_TEXTURED); 78 window->Init(ui::LAYER_TEXTURED);
79 window->SetBounds(gfx::Rect(100, 100)); 79 window->SetBounds(gfx::Rect(100, 100));
80 ParentWindowInPrimaryRootWindow(window); 80 ParentWindowInPrimaryRootWindow(window);
81 return window; 81 return window;
82 } 82 }
83 aura::Window* CreateAlwaysOnTopWindowInPrimary() { 83 aura::Window* CreateAlwaysOnTopWindowInPrimary() {
84 aura::Window* window = new aura::Window(NULL); 84 aura::Window* window = new aura::Window(NULL);
85 window->SetType(aura::client::WINDOW_TYPE_NORMAL); 85 window->SetType(ui::wm::WINDOW_TYPE_NORMAL);
86 window->Init(ui::LAYER_TEXTURED); 86 window->Init(ui::LAYER_TEXTURED);
87 window->SetBounds(gfx::Rect(100, 100)); 87 window->SetBounds(gfx::Rect(100, 100));
88 window->SetProperty(aura::client::kAlwaysOnTopKey, true); 88 window->SetProperty(aura::client::kAlwaysOnTopKey, true);
89 ParentWindowInPrimaryRootWindow(window); 89 ParentWindowInPrimaryRootWindow(window);
90 return window; 90 return window;
91 } 91 }
92 aura::Window* CreatePanelWindowInPrimary() { 92 aura::Window* CreatePanelWindowInPrimary() {
93 aura::Window* window = new aura::Window(NULL); 93 aura::Window* window = new aura::Window(NULL);
94 window->SetType(aura::client::WINDOW_TYPE_PANEL); 94 window->SetType(ui::wm::WINDOW_TYPE_PANEL);
95 window->Init(ui::LAYER_TEXTURED); 95 window->Init(ui::LAYER_TEXTURED);
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.
(...skipping 184 matching lines...) Expand 10 before | Expand all | Expand 10 after
289 // Non-drawing windows should not affect the solo computation. 289 // Non-drawing windows should not affect the solo computation.
290 TEST_F(SoloWindowTrackerTest, NotDrawn) { 290 TEST_F(SoloWindowTrackerTest, NotDrawn) {
291 aura::Window* w = CreateWindowInPrimary(); 291 aura::Window* w = CreateWindowInPrimary();
292 w->Show(); 292 w->Show();
293 293
294 // We only have one window, so it should use a solo header. 294 // We only have one window, so it should use a solo header.
295 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary()); 295 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary());
296 296
297 // Create non-drawing window similar to DragDropTracker. 297 // Create non-drawing window similar to DragDropTracker.
298 aura::Window* not_drawn = new aura::Window(NULL); 298 aura::Window* not_drawn = new aura::Window(NULL);
299 not_drawn->SetType(aura::client::WINDOW_TYPE_NORMAL); 299 not_drawn->SetType(ui::wm::WINDOW_TYPE_NORMAL);
300 not_drawn->Init(ui::LAYER_NOT_DRAWN); 300 not_drawn->Init(ui::LAYER_NOT_DRAWN);
301 ParentWindowInPrimaryRootWindow(not_drawn); 301 ParentWindowInPrimaryRootWindow(not_drawn);
302 not_drawn->Show(); 302 not_drawn->Show();
303 303
304 // Despite two windows, the first window should still be considered "solo" 304 // Despite two windows, the first window should still be considered "solo"
305 // because non-drawing windows aren't included in the computation. 305 // because non-drawing windows aren't included in the computation.
306 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary()); 306 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary());
307 } 307 }
308 308
309 TEST_F(SoloWindowTrackerTest, MultiDisplay) { 309 TEST_F(SoloWindowTrackerTest, MultiDisplay) {
(...skipping 78 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 388
389 TEST_F(SoloWindowTrackerTest, ChildWindowVisibility) { 389 TEST_F(SoloWindowTrackerTest, ChildWindowVisibility) {
390 aura::Window* w = CreateWindowInPrimary(); 390 aura::Window* w = CreateWindowInPrimary();
391 w->Show(); 391 w->Show();
392 392
393 // We only have one window, so it should use a solo header. 393 // We only have one window, so it should use a solo header.
394 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary()); 394 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary());
395 395
396 // Create a child window. This should not affect the solo-ness of |w1|. 396 // Create a child window. This should not affect the solo-ness of |w1|.
397 aura::Window* child = new aura::Window(NULL); 397 aura::Window* child = new aura::Window(NULL);
398 child->SetType(aura::client::WINDOW_TYPE_CONTROL); 398 child->SetType(ui::wm::WINDOW_TYPE_CONTROL);
399 child->Init(ui::LAYER_TEXTURED); 399 child->Init(ui::LAYER_TEXTURED);
400 child->SetBounds(gfx::Rect(100, 100)); 400 child->SetBounds(gfx::Rect(100, 100));
401 w->AddChild(child); 401 w->AddChild(child);
402 child->Show(); 402 child->Show();
403 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary()); 403 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary());
404 404
405 // Changing the visibility of |child| should not affect the solo-ness of |w1|. 405 // Changing the visibility of |child| should not affect the solo-ness of |w1|.
406 child->Hide(); 406 child->Hide();
407 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary()); 407 EXPECT_EQ(w, GetWindowWithSoloHeaderInPrimary());
408 } 408 }
(...skipping 11 matching lines...) Expand all
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/solo_window_tracker.cc ('k') | ash/wm/stacking_controller.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698