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

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

Issue 2162193003: Separates out accelerators using non-common types (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@accelerators
Patch Set: sim=20 Created 4 years, 5 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/wm/window_util.cc ('k') | chrome/browser/policy/policy_browsertest.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) 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 "ash/wm/window_util.h" 5 #include "ash/wm/window_util.h"
6 6
7 #include "ash/aura/wm_window_aura.h"
7 #include "ash/common/wm/window_positioning_utils.h" 8 #include "ash/common/wm/window_positioning_utils.h"
8 #include "ash/common/wm/window_state.h" 9 #include "ash/common/wm/window_state.h"
9 #include "ash/screen_util.h" 10 #include "ash/screen_util.h"
10 #include "ash/test/ash_test_base.h" 11 #include "ash/test/ash_test_base.h"
11 #include "ash/wm/window_state_aura.h" 12 #include "ash/wm/window_state_aura.h"
12 #include "ui/aura/window.h" 13 #include "ui/aura/window.h"
13 14
14 namespace ash { 15 namespace ash {
15 16
16 namespace { 17 namespace {
(...skipping 11 matching lines...) Expand all
28 if (!SupportsMultipleDisplays()) 29 if (!SupportsMultipleDisplays())
29 return; 30 return;
30 31
31 UpdateDisplay("500x400, 600x400"); 32 UpdateDisplay("500x400, 600x400");
32 std::unique_ptr<aura::Window> window( 33 std::unique_ptr<aura::Window> window(
33 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100))); 34 CreateTestWindowInShellWithBounds(gfx::Rect(12, 20, 100, 100)));
34 35
35 wm::WindowState* window_state = wm::GetWindowState(window.get()); 36 wm::WindowState* window_state = wm::GetWindowState(window.get());
36 EXPECT_FALSE(window_state->bounds_changed_by_user()); 37 EXPECT_FALSE(window_state->bounds_changed_by_user());
37 38
38 wm::CenterWindow(window.get()); 39 wm::CenterWindow(WmWindowAura::Get(window.get()));
39 // Centring window is considered as a user's action. 40 // Centring window is considered as a user's action.
40 EXPECT_TRUE(window_state->bounds_changed_by_user()); 41 EXPECT_TRUE(window_state->bounds_changed_by_user());
41 EXPECT_EQ("200,126 100x100", window->bounds().ToString()); 42 EXPECT_EQ("200,126 100x100", window->bounds().ToString());
42 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString()); 43 EXPECT_EQ("200,126 100x100", window->GetBoundsInScreen().ToString());
43 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100), 44 window->SetBoundsInScreen(gfx::Rect(600, 0, 100, 100),
44 ScreenUtil::GetSecondaryDisplay()); 45 ScreenUtil::GetSecondaryDisplay());
45 wm::CenterWindow(window.get()); 46 wm::CenterWindow(WmWindowAura::Get(window.get()));
46 EXPECT_EQ("250,126 100x100", window->bounds().ToString()); 47 EXPECT_EQ("250,126 100x100", window->bounds().ToString());
47 EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString()); 48 EXPECT_EQ("750,126 100x100", window->GetBoundsInScreen().ToString());
48 } 49 }
49 50
50 TEST_F(WindowUtilTest, AdjustBoundsToEnsureMinimumVisibility) { 51 TEST_F(WindowUtilTest, AdjustBoundsToEnsureMinimumVisibility) {
51 const gfx::Rect visible_bounds(0, 0, 100, 100); 52 const gfx::Rect visible_bounds(0, 0, 100, 100);
52 53
53 EXPECT_EQ("0,0 90x90", 54 EXPECT_EQ("0,0 90x90",
54 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 90, 90))); 55 GetAdjustedBounds(visible_bounds, gfx::Rect(0, 0, 90, 90)));
55 EXPECT_EQ("0,0 100x100", 56 EXPECT_EQ("0,0 100x100",
(...skipping 29 matching lines...) Expand all
85 "-250,-40 100x100", 86 "-250,-40 100x100",
86 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150))); 87 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-250, -40, 150, 150)));
87 EXPECT_EQ( 88 EXPECT_EQ(
88 "-275,-50 100x100", 89 "-275,-50 100x100",
89 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150))); 90 GetAdjustedBounds(visible_bounds_left, gfx::Rect(-400, -60, 150, 150)));
90 EXPECT_EQ("-125,0 100x100", 91 EXPECT_EQ("-125,0 100x100",
91 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150))); 92 GetAdjustedBounds(visible_bounds_left, gfx::Rect(0, 0, 150, 150)));
92 } 93 }
93 94
94 } // namespace ash 95 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/window_util.cc ('k') | chrome/browser/policy/policy_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698