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

Side by Side Diff: ash/wm/overview/window_selector_unittest.cc

Issue 2633643002: [ash-md] Reduces dimensions of texture layers in overview mode (Closed)
Patch Set: [ash-md] Reduces dimensions of texture layers in overview mode (test) Created 3 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
« no previous file with comments | « ash/common/wm/overview/window_selector_item.cc ('k') | no next file » | 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 <algorithm> 5 #include <algorithm>
6 #include <vector> 6 #include <vector>
7 7
8 #include "ash/aura/wm_window_aura.h" 8 #include "ash/aura/wm_window_aura.h"
9 #include "ash/common/accessibility_delegate.h" 9 #include "ash/common/accessibility_delegate.h"
10 #include "ash/common/accessibility_types.h" 10 #include "ash/common/accessibility_types.h"
(...skipping 50 matching lines...) Expand 10 before | Expand all | Expand 10 after
61 #include "ui/display/test/display_manager_test_api.h" 61 #include "ui/display/test/display_manager_test_api.h"
62 #include "ui/events/event_utils.h" 62 #include "ui/events/event_utils.h"
63 #include "ui/events/test/event_generator.h" 63 #include "ui/events/test/event_generator.h"
64 #include "ui/gfx/animation/slide_animation.h" 64 #include "ui/gfx/animation/slide_animation.h"
65 #include "ui/gfx/geometry/point_conversions.h" 65 #include "ui/gfx/geometry/point_conversions.h"
66 #include "ui/gfx/geometry/rect_conversions.h" 66 #include "ui/gfx/geometry/rect_conversions.h"
67 #include "ui/gfx/geometry/safe_integer_conversions.h" 67 #include "ui/gfx/geometry/safe_integer_conversions.h"
68 #include "ui/gfx/transform.h" 68 #include "ui/gfx/transform.h"
69 #include "ui/gfx/transform_util.h" 69 #include "ui/gfx/transform_util.h"
70 #include "ui/views/controls/button/image_button.h" 70 #include "ui/views/controls/button/image_button.h"
71 #include "ui/views/controls/button/label_button.h" 71 #include "ui/views/controls/label.h"
72 #include "ui/views/widget/native_widget_aura.h" 72 #include "ui/views/widget/native_widget_aura.h"
73 #include "ui/views/widget/widget_delegate.h" 73 #include "ui/views/widget/widget_delegate.h"
74 #include "ui/wm/core/window_util.h" 74 #include "ui/wm/core/window_util.h"
75 #include "ui/wm/public/activation_delegate.h" 75 #include "ui/wm/public/activation_delegate.h"
76 76
77 namespace ash { 77 namespace ash {
78 namespace { 78 namespace {
79 79
80 // The label covers selector item windows with a padding in order to prevent 80 // The label covers selector item windows with a padding in order to prevent
81 // them from receiving user input events while in overview. 81 // them from receiving user input events while in overview.
(...skipping 235 matching lines...) Expand 10 before | Expand all | Expand 10 after
317 ->text_filter_widget_->GetNativeWindow() 317 ->text_filter_widget_->GetNativeWindow()
318 ->layer() 318 ->layer()
319 ->GetTargetTransform() 319 ->GetTargetTransform()
320 .IsIdentity(); 320 .IsIdentity();
321 } 321 }
322 322
323 views::Widget* GetCloseButton(WindowSelectorItem* window) { 323 views::Widget* GetCloseButton(WindowSelectorItem* window) {
324 return window->close_button_->GetWidget(); 324 return window->close_button_->GetWidget();
325 } 325 }
326 326
327 views::LabelButton* GetLabelButtonView(WindowSelectorItem* window) { 327 views::Label* GetLabelView(WindowSelectorItem* window) {
328 return window->window_label_button_view_; 328 return window->label_view_;
329 } 329 }
330 330
331 // Tests that a window is contained within a given WindowSelectorItem, and 331 // Tests that a window is contained within a given WindowSelectorItem, and
332 // that both the window and its matching close button are within the same 332 // that both the window and its matching close button are within the same
333 // screen. 333 // screen.
334 void IsWindowAndCloseButtonInScreen(aura::Window* window, 334 void IsWindowAndCloseButtonInScreen(aura::Window* window,
335 WindowSelectorItem* window_item) { 335 WindowSelectorItem* window_item) {
336 aura::Window* root_window = 336 aura::Window* root_window =
337 WmWindowAura::GetAuraWindow(window_item->root_window()); 337 WmWindowAura::GetAuraWindow(window_item->root_window());
338 EXPECT_TRUE(window_item->Contains(WmWindowAura::Get(window))); 338 EXPECT_TRUE(window_item->Contains(WmWindowAura::Get(window)));
(...skipping 1224 matching lines...) Expand 10 before | Expand all | Expand 10 after
1563 RunAllPendingInMessageLoop(); 1563 RunAllPendingInMessageLoop();
1564 } 1564 }
1565 1565
1566 // Test that a label is created under the window on entering overview mode. 1566 // Test that a label is created under the window on entering overview mode.
1567 TEST_F(WindowSelectorTest, CreateLabelUnderWindow) { 1567 TEST_F(WindowSelectorTest, CreateLabelUnderWindow) {
1568 std::unique_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 300, 500))); 1568 std::unique_ptr<aura::Window> window(CreateWindow(gfx::Rect(0, 0, 300, 500)));
1569 base::string16 window_title = base::UTF8ToUTF16("My window"); 1569 base::string16 window_title = base::UTF8ToUTF16("My window");
1570 window->SetTitle(window_title); 1570 window->SetTitle(window_title);
1571 ToggleOverview(); 1571 ToggleOverview();
1572 WindowSelectorItem* window_item = GetWindowItemsForRoot(0).back(); 1572 WindowSelectorItem* window_item = GetWindowItemsForRoot(0).back();
1573 views::LabelButton* label = GetLabelButtonView(window_item); 1573 views::Label* label = GetLabelView(window_item);
1574 // Has the label view been created? 1574 // Has the label view been created?
1575 ASSERT_TRUE(label); 1575 ASSERT_TRUE(label);
1576 1576
1577 // Verify the label matches the window title. 1577 // Verify the label matches the window title.
1578 EXPECT_EQ(label->GetText(), window_title); 1578 EXPECT_EQ(label->text(), window_title);
1579 1579
1580 // Update the window title and check that the label is updated, too. 1580 // Update the window title and check that the label is updated, too.
1581 base::string16 updated_title = base::UTF8ToUTF16("Updated title"); 1581 base::string16 updated_title = base::UTF8ToUTF16("Updated title");
1582 window->SetTitle(updated_title); 1582 window->SetTitle(updated_title);
1583 EXPECT_EQ(label->GetText(), updated_title); 1583 EXPECT_EQ(label->text(), updated_title);
1584 1584
1585 // Labels are located based on target_bounds, not the actual window item 1585 // Labels are located based on target_bounds, not the actual window item
1586 // bounds. 1586 // bounds.
1587 gfx::Rect label_bounds = label->GetWidget()->GetWindowBoundsInScreen(); 1587 gfx::Rect label_bounds = label->GetWidget()->GetWindowBoundsInScreen();
1588 label_bounds.Inset(kWindowMargin, kWindowMargin); 1588 label_bounds.Inset(kWindowMargin, kWindowMargin);
1589 EXPECT_EQ(window_item->target_bounds(), label_bounds); 1589 EXPECT_EQ(window_item->target_bounds(), label_bounds);
1590 } 1590 }
1591 1591
1592 // Tests that overview updates the window positions if the display orientation 1592 // Tests that overview updates the window positions if the display orientation
1593 // changes. 1593 // changes.
(...skipping 547 matching lines...) Expand 10 before | Expand all | Expand 10 after
2141 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE)); 2141 HTCAPTION, aura::client::WINDOW_MOVE_SOURCE_MOUSE));
2142 ASSERT_TRUE(resizer.get()); 2142 ASSERT_TRUE(resizer.get());
2143 gfx::Point location = resizer->GetInitialLocation(); 2143 gfx::Point location = resizer->GetInitialLocation();
2144 location.Offset(20, 20); 2144 location.Offset(20, 20);
2145 resizer->Drag(location, 0); 2145 resizer->Drag(location, 0);
2146 ToggleOverview(); 2146 ToggleOverview();
2147 resizer->RevertDrag(); 2147 resizer->RevertDrag();
2148 } 2148 }
2149 2149
2150 } // namespace ash 2150 } // namespace ash
OLDNEW
« no previous file with comments | « ash/common/wm/overview/window_selector_item.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698