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

Side by Side Diff: ash/wm/panels/panel_window_resizer_unittest.cc

Issue 557693002: [Ash] Only snap windows that can maximize. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix up other tests. Created 6 years, 3 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
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/panels/panel_window_resizer.h" 5 #include "ash/wm/panels/panel_window_resizer.h"
6 6
7 #include "ash/root_window_controller.h" 7 #include "ash/root_window_controller.h"
8 #include "ash/shelf/shelf.h" 8 #include "ash/shelf/shelf.h"
9 #include "ash/shelf/shelf_layout_manager.h" 9 #include "ash/shelf/shelf_layout_manager.h"
10 #include "ash/shelf/shelf_model.h" 10 #include "ash/shelf/shelf_model.h"
11 #include "ash/shelf/shelf_types.h" 11 #include "ash/shelf/shelf_types.h"
12 #include "ash/shelf/shelf_util.h" 12 #include "ash/shelf/shelf_util.h"
13 #include "ash/shelf/shelf_widget.h" 13 #include "ash/shelf/shelf_widget.h"
14 #include "ash/shell.h" 14 #include "ash/shell.h"
15 #include "ash/shell_window_ids.h" 15 #include "ash/shell_window_ids.h"
16 #include "ash/test/ash_test_base.h" 16 #include "ash/test/ash_test_base.h"
17 #include "ash/test/cursor_manager_test_api.h" 17 #include "ash/test/cursor_manager_test_api.h"
18 #include "ash/test/shell_test_api.h" 18 #include "ash/test/shell_test_api.h"
19 #include "ash/test/test_shelf_delegate.h" 19 #include "ash/test/test_shelf_delegate.h"
20 #include "ash/wm/drag_window_resizer.h" 20 #include "ash/wm/drag_window_resizer.h"
21 #include "ash/wm/panels/panel_layout_manager.h" 21 #include "ash/wm/panels/panel_layout_manager.h"
22 #include "ash/wm/window_state.h" 22 #include "ash/wm/window_state.h"
23 #include "ash/wm/wm_event.h" 23 #include "ash/wm/wm_event.h"
24 #include "base/win/windows_version.h" 24 #include "base/win/windows_version.h"
25 #include "ui/aura/client/aura_constants.h" 25 #include "ui/aura/client/aura_constants.h"
26 #include "ui/aura/test/test_window_delegate.h"
26 #include "ui/aura/window_event_dispatcher.h" 27 #include "ui/aura/window_event_dispatcher.h"
27 #include "ui/base/hit_test.h" 28 #include "ui/base/hit_test.h"
28 #include "ui/base/l10n/l10n_util.h" 29 #include "ui/base/l10n/l10n_util.h"
29 #include "ui/base/ui_base_types.h" 30 #include "ui/base/ui_base_types.h"
30 #include "ui/views/widget/widget.h" 31 #include "ui/views/widget/widget.h"
31 #include "ui/wm/core/window_util.h" 32 #include "ui/wm/core/window_util.h"
32 33
33 namespace ash { 34 namespace ash {
34 35
35 class PanelWindowResizerTest : public test::AshTestBase { 36 class PanelWindowResizerTest : public test::AshTestBase {
(...skipping 358 matching lines...) Expand 10 before | Expand all | Expand 10 after
394 } 395 }
395 396
396 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) { 397 TEST_F(PanelWindowResizerTest, AttachToSecondFullscreenDisplay) {
397 if (!SupportsMultipleDisplays()) 398 if (!SupportsMultipleDisplays())
398 return; 399 return;
399 400
400 UpdateDisplay("600x400,600x600"); 401 UpdateDisplay("600x400,600x600");
401 aura::Window::Windows root_windows = Shell::GetAllRootWindows(); 402 aura::Window::Windows root_windows = Shell::GetAllRootWindows();
402 scoped_ptr<aura::Window> window( 403 scoped_ptr<aura::Window> window(
403 CreatePanelWindow(gfx::Point(0, 0))); 404 CreatePanelWindow(gfx::Point(0, 0)));
404 scoped_ptr<aura::Window> fullscreen( 405 scoped_ptr<aura::Window> fullscreen(CreateTestWindowInShellWithDelegate(
405 CreateTestWindowInShellWithBounds(gfx::Rect(600, 0, 101, 101))); 406 aura::test::TestWindowDelegate::CreateSelfDestroyingDelegate(),
407 0,
408 gfx::Rect(600, 0, 101, 101)));
409 fullscreen->SetProperty(aura::client::kCanMaximizeKey, true);
406 wm::GetWindowState(fullscreen.get())->Activate(); 410 wm::GetWindowState(fullscreen.get())->Activate();
407 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN); 411 const wm::WMEvent event(wm::WM_EVENT_TOGGLE_FULLSCREEN);
408 wm::GetWindowState(fullscreen.get())->OnWMEvent(&event); 412 wm::GetWindowState(fullscreen.get())->OnWMEvent(&event);
409 EXPECT_TRUE(wm::GetWindowState(fullscreen.get())->IsFullscreen()); 413 EXPECT_TRUE(wm::GetWindowState(fullscreen.get())->IsFullscreen());
410 414
411 gfx::Rect initial_bounds = window->GetBoundsInScreen(); 415 gfx::Rect initial_bounds = window->GetBoundsInScreen();
412 EXPECT_EQ(root_windows[0], window->GetRootWindow()); 416 EXPECT_EQ(root_windows[0], window->GetRootWindow());
413 417
414 // Activate and drag the window to the other display's launcher. 418 // Activate and drag the window to the other display's launcher.
415 wm::GetWindowState(window.get())->Activate(); 419 wm::GetWindowState(window.get())->Activate();
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
554 558
555 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest, 559 INSTANTIATE_TEST_CASE_P(LtrRtl, PanelWindowResizerTextDirectionTest,
556 testing::Bool()); 560 testing::Bool());
557 INSTANTIATE_TEST_CASE_P(NormalPanelPopup, 561 INSTANTIATE_TEST_CASE_P(NormalPanelPopup,
558 PanelWindowResizerTransientTest, 562 PanelWindowResizerTransientTest,
559 testing::Values(ui::wm::WINDOW_TYPE_NORMAL, 563 testing::Values(ui::wm::WINDOW_TYPE_NORMAL,
560 ui::wm::WINDOW_TYPE_PANEL, 564 ui::wm::WINDOW_TYPE_PANEL,
561 ui::wm::WINDOW_TYPE_POPUP)); 565 ui::wm::WINDOW_TYPE_POPUP));
562 566
563 } // namespace ash 567 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698