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

Side by Side Diff: ash/wm/workspace/workspace_layout_manager_unittest.cc

Issue 357063002: Snap widgets to pixel boundary on ash (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: adjust tests Created 6 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 | Annotate | Revision Log
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.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 (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/workspace/workspace_layout_manager.h" 5 #include "ash/wm/workspace/workspace_layout_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "ash/display/display_layout.h" 9 #include "ash/display/display_layout.h"
10 #include "ash/display/display_manager.h" 10 #include "ash/display/display_manager.h"
(...skipping 505 matching lines...) Expand 10 before | Expand all | Expand 10 after
516 window_state2->OnWMEvent(&toggle_fullscreen_event); 516 window_state2->OnWMEvent(&toggle_fullscreen_event);
517 EXPECT_EQ(5, observer.call_count()); 517 EXPECT_EQ(5, observer.call_count());
518 EXPECT_TRUE(observer.is_fullscreen()); 518 EXPECT_TRUE(observer.is_fullscreen());
519 519
520 // Closing the window should change the fullscreen state. 520 // Closing the window should change the fullscreen state.
521 window2.reset(); 521 window2.reset();
522 EXPECT_EQ(6, observer.call_count()); 522 EXPECT_EQ(6, observer.call_count());
523 EXPECT_FALSE(observer.is_fullscreen()); 523 EXPECT_FALSE(observer.is_fullscreen());
524 } 524 }
525 525
526 // Following tests were originally written for BaseLayoutManager. 526 // Following "Solo" tests were originally written for BaseLayoutManager.
527
528 namespace { 527 namespace {
529 528
530 class WorkspaceLayoutManagerSoloTest : public test::AshTestBase { 529 class WorkspaceLayoutManagerSoloTest : public test::AshTestBase {
531 public: 530 public:
532 WorkspaceLayoutManagerSoloTest() {} 531 WorkspaceLayoutManagerSoloTest() {}
533 virtual ~WorkspaceLayoutManagerSoloTest() {} 532 virtual ~WorkspaceLayoutManagerSoloTest() {}
534 533
535 virtual void SetUp() OVERRIDE {
536 test::AshTestBase::SetUp();
537 UpdateDisplay("800x600");
538 aura::Window* default_container = Shell::GetContainer(
539 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
540 default_container->SetLayoutManager(
541 new WorkspaceLayoutManager(Shell::GetPrimaryRootWindow()));
542 }
543
544 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 534 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
545 return CreateTestWindowInShellWithBounds(bounds); 535 return CreateTestWindowInShellWithBounds(bounds);
546 } 536 }
547 537
548 private: 538 private:
549 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerSoloTest); 539 DISALLOW_COPY_AND_ASSIGN(WorkspaceLayoutManagerSoloTest);
550 }; 540 };
551 541
552 } // namespace 542 } // namespace
553 543
(...skipping 432 matching lines...) Expand 10 before | Expand all | Expand 10 after
986 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase { 976 class WorkspaceLayoutManagerKeyboardTest : public test::AshTestBase {
987 public: 977 public:
988 WorkspaceLayoutManagerKeyboardTest() {} 978 WorkspaceLayoutManagerKeyboardTest() {}
989 virtual ~WorkspaceLayoutManagerKeyboardTest() {} 979 virtual ~WorkspaceLayoutManagerKeyboardTest() {}
990 980
991 virtual void SetUp() OVERRIDE { 981 virtual void SetUp() OVERRIDE {
992 test::AshTestBase::SetUp(); 982 test::AshTestBase::SetUp();
993 UpdateDisplay("800x600"); 983 UpdateDisplay("800x600");
994 aura::Window* default_container = Shell::GetContainer( 984 aura::Window* default_container = Shell::GetContainer(
995 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer); 985 Shell::GetPrimaryRootWindow(), kShellWindowId_DefaultContainer);
996 layout_manager_ = new WorkspaceLayoutManager(Shell::GetPrimaryRootWindow()); 986 layout_manager_ = static_cast<WorkspaceLayoutManager*>(
997 default_container->SetLayoutManager(layout_manager_); 987 default_container->layout_manager());
998 } 988 }
999 989
1000 aura::Window* CreateTestWindow(const gfx::Rect& bounds) { 990 aura::Window* CreateTestWindow(const gfx::Rect& bounds) {
1001 return CreateTestWindowInShellWithBounds(bounds); 991 return CreateTestWindowInShellWithBounds(bounds);
1002 } 992 }
1003 993
1004 void ShowKeyboard() { 994 void ShowKeyboard() {
1005 restore_work_area_insets_ = Shell::GetScreen()->GetPrimaryDisplay(). 995 restore_work_area_insets_ = Shell::GetScreen()->GetPrimaryDisplay().
1006 GetWorkAreaInsets(); 996 GetWorkAreaInsets();
1007 Shell::GetInstance()->SetDisplayWorkAreaInsets( 997 Shell::GetInstance()->SetDisplayWorkAreaInsets(
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
1087 HideKeyboard(); 1077 HideKeyboard();
1088 if (switches::IsTextInputFocusManagerEnabled()) { 1078 if (switches::IsTextInputFocusManagerEnabled()) {
1089 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient( 1079 ui::TextInputFocusManager::GetInstance()->BlurTextInputClient(
1090 &text_input_client); 1080 &text_input_client);
1091 } else { 1081 } else {
1092 input_method->SetFocusedTextInputClient(NULL); 1082 input_method->SetFocusedTextInputClient(NULL);
1093 } 1083 }
1094 } 1084 }
1095 1085
1096 } // namespace ash 1086 } // namespace ash
OLDNEW
« no previous file with comments | « ash/wm/workspace/workspace_layout_manager.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698