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

Side by Side Diff: ash/extended_desktop_unittest.cc

Issue 10827184: Disabling extended desktop (by default). (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebased. Created 8 years, 4 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/display/multi_display_manager_unittest.cc ('k') | ash/root_window_controller_unittest.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) 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/display/display_controller.h" 5 #include "ash/display/display_controller.h"
6 #include "ash/display/multi_display_manager.h" 6 #include "ash/display/multi_display_manager.h"
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 8 #include "ash/test/ash_test_base.h"
9 #include "ash/wm/coordinate_conversion.h" 9 #include "ash/wm/coordinate_conversion.h"
10 #include "ash/wm/property_util.h" 10 #include "ash/wm/property_util.h"
(...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after
54 return this; 54 return this;
55 } 55 }
56 virtual ui::ModalType GetModalType() const OVERRIDE { 56 virtual ui::ModalType GetModalType() const OVERRIDE {
57 return ui::MODAL_TYPE_SYSTEM; 57 return ui::MODAL_TYPE_SYSTEM;
58 } 58 }
59 59
60 private: 60 private:
61 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate); 61 DISALLOW_COPY_AND_ASSIGN(ModalWidgetDelegate);
62 }; 62 };
63 63
64 internal::MultiDisplayManager* GetDisplayManager() {
65 return static_cast<internal::MultiDisplayManager*>(
66 aura::Env::GetInstance()->display_manager());
67 }
68
69 } // namespace 64 } // namespace
70 65
71 typedef test::AshTestBase ExtendedDesktopTest; 66 class ExtendedDesktopTest : public test::AshTestBase {
67 public:
68 ExtendedDesktopTest() {}
69 virtual ~ExtendedDesktopTest() {}
70
71 virtual void SetUp() OVERRIDE {
72 internal::DisplayController::SetExtendedDesktopEnabled(true);
73 AshTestBase::SetUp();
74 }
75
76 virtual void TearDown() OVERRIDE {
77 AshTestBase::TearDown();
78 internal::DisplayController::SetExtendedDesktopEnabled(false);
79 }
80
81 protected:
82 internal::MultiDisplayManager* display_manager() {
83 return static_cast<internal::MultiDisplayManager*>(
84 aura::Env::GetInstance()->display_manager());
85 }
86
87 private:
88 DISALLOW_COPY_AND_ASSIGN(ExtendedDesktopTest);
89 };
72 90
73 // Test conditions that root windows in extended desktop mode 91 // Test conditions that root windows in extended desktop mode
74 // must satisfy. 92 // must satisfy.
75 TEST_F(ExtendedDesktopTest, Basic) { 93 TEST_F(ExtendedDesktopTest, Basic) {
76 UpdateDisplay("1000x600,600x400"); 94 UpdateDisplay("1000x600,600x400");
77 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 95 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
78 96
79 // All root windows must have the root window controller. 97 // All root windows must have the root window controller.
80 ASSERT_EQ(2U, root_windows.size()); 98 ASSERT_EQ(2U, root_windows.size());
81 for (Shell::RootWindowList::const_iterator iter = root_windows.begin(); 99 for (Shell::RootWindowList::const_iterator iter = root_windows.begin();
(...skipping 356 matching lines...) Expand 10 before | Expand all | Expand 10 after
438 w1_t1->GetWindowBoundsInScreen().ToString()); 456 w1_t1->GetWindowBoundsInScreen().ToString());
439 } 457 }
440 458
441 namespace internal { 459 namespace internal {
442 // Test if the Window::ConvertPointToWindow works across root windows. 460 // Test if the Window::ConvertPointToWindow works across root windows.
443 // TODO(oshima): Move multiple display suport and this test to aura. 461 // TODO(oshima): Move multiple display suport and this test to aura.
444 TEST_F(ExtendedDesktopTest, ConvertPoint) { 462 TEST_F(ExtendedDesktopTest, ConvertPoint) {
445 UpdateDisplay("1000x600,600x400"); 463 UpdateDisplay("1000x600,600x400");
446 Shell::RootWindowList root_windows = Shell::GetAllRootWindows(); 464 Shell::RootWindowList root_windows = Shell::GetAllRootWindows();
447 gfx::Display& display_1 = 465 gfx::Display& display_1 =
448 GetDisplayManager()->FindDisplayForRootWindow(root_windows[0]); 466 display_manager()->FindDisplayForRootWindow(root_windows[0]);
449 EXPECT_EQ("0,0", display_1.bounds().origin().ToString()); 467 EXPECT_EQ("0,0", display_1.bounds().origin().ToString());
450 gfx::Display& display_2 = 468 gfx::Display& display_2 =
451 GetDisplayManager()->FindDisplayForRootWindow(root_windows[1]); 469 display_manager()->FindDisplayForRootWindow(root_windows[1]);
452 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString()); 470 EXPECT_EQ("1000,0", display_2.bounds().origin().ToString());
453 471
454 aura::Window* d1 = 472 aura::Window* d1 =
455 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView(); 473 CreateTestWidget(gfx::Rect(10, 10, 100, 100))->GetNativeView();
456 aura::Window* d2 = 474 aura::Window* d2 =
457 CreateTestWidget(gfx::Rect(1020, 20, 100, 100))->GetNativeView(); 475 CreateTestWidget(gfx::Rect(1020, 20, 100, 100))->GetNativeView();
458 EXPECT_EQ(root_windows[0], d1->GetRootWindow()); 476 EXPECT_EQ(root_windows[0], d1->GetRootWindow());
459 EXPECT_EQ(root_windows[1], d2->GetRootWindow()); 477 EXPECT_EQ(root_windows[1], d2->GetRootWindow());
460 478
461 // Convert point in the Root2's window to the Root1's window Coord. 479 // Convert point in the Root2's window to the Root1's window Coord.
462 gfx::Point p(0, 0); 480 gfx::Point p(0, 0);
463 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); 481 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p);
464 EXPECT_EQ("1000,0", p.ToString()); 482 EXPECT_EQ("1000,0", p.ToString());
465 p.SetPoint(0, 0); 483 p.SetPoint(0, 0);
466 aura::Window::ConvertPointToWindow(d2, d1, &p); 484 aura::Window::ConvertPointToWindow(d2, d1, &p);
467 EXPECT_EQ("1010,10", p.ToString()); 485 EXPECT_EQ("1010,10", p.ToString());
468 486
469 // Convert point in the Root1's window to the Root2's window Coord. 487 // Convert point in the Root1's window to the Root2's window Coord.
470 p.SetPoint(0, 0); 488 p.SetPoint(0, 0);
471 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); 489 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p);
472 EXPECT_EQ("-1000,0", p.ToString()); 490 EXPECT_EQ("-1000,0", p.ToString());
473 p.SetPoint(0, 0); 491 p.SetPoint(0, 0);
474 aura::Window::ConvertPointToWindow(d1, d2, &p); 492 aura::Window::ConvertPointToWindow(d1, d2, &p);
475 EXPECT_EQ("-1010,-10", p.ToString()); 493 EXPECT_EQ("-1010,-10", p.ToString());
476 494
477 // Move the 2nd display to the bottom and test again. 495 // Move the 2nd display to the bottom and test again.
478 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout( 496 Shell::GetInstance()->display_controller()->SetSecondaryDisplayLayout(
479 internal::DisplayController::BOTTOM); 497 internal::DisplayController::BOTTOM);
480 498
481 display_2 = GetDisplayManager()->FindDisplayForRootWindow(root_windows[1]); 499 display_2 = display_manager()->FindDisplayForRootWindow(root_windows[1]);
482 EXPECT_EQ("0,600", display_2.bounds().origin().ToString()); 500 EXPECT_EQ("0,600", display_2.bounds().origin().ToString());
483 501
484 // Convert point in Root2's window to Root1's window Coord. 502 // Convert point in Root2's window to Root1's window Coord.
485 p.SetPoint(0, 0); 503 p.SetPoint(0, 0);
486 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p); 504 aura::Window::ConvertPointToWindow(root_windows[1], root_windows[0], &p);
487 EXPECT_EQ("0,600", p.ToString()); 505 EXPECT_EQ("0,600", p.ToString());
488 p.SetPoint(0, 0); 506 p.SetPoint(0, 0);
489 aura::Window::ConvertPointToWindow(d2, d1, &p); 507 aura::Window::ConvertPointToWindow(d2, d1, &p);
490 EXPECT_EQ("10,610", p.ToString()); 508 EXPECT_EQ("10,610", p.ToString());
491 509
492 // Convert point in Root1's window to Root2's window Coord. 510 // Convert point in Root1's window to Root2's window Coord.
493 p.SetPoint(0, 0); 511 p.SetPoint(0, 0);
494 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p); 512 aura::Window::ConvertPointToWindow(root_windows[0], root_windows[1], &p);
495 EXPECT_EQ("0,-600", p.ToString()); 513 EXPECT_EQ("0,-600", p.ToString());
496 p.SetPoint(0, 0); 514 p.SetPoint(0, 0);
497 aura::Window::ConvertPointToWindow(d1, d2, &p); 515 aura::Window::ConvertPointToWindow(d1, d2, &p);
498 EXPECT_EQ("-10,-610", p.ToString()); 516 EXPECT_EQ("-10,-610", p.ToString());
499 } 517 }
500 518
501 } // namespace internal 519 } // namespace internal
502 } // namespace ash 520 } // namespace ash
OLDNEW
« no previous file with comments | « ash/display/multi_display_manager_unittest.cc ('k') | ash/root_window_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698