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

Side by Side Diff: ash/magnifier/magnification_controller_unittest.cc

Issue 1119953002: Enable display rotation, magnifier in unified desktop mode (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 7 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/magnifier/magnification_controller.h" 5 #include "ash/magnifier/magnification_controller.h"
6 6
7 #include "ash/display/display_manager.h"
7 #include "ash/shell.h" 8 #include "ash/shell.h"
8 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
9 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
10 #include "ui/aura/client/aura_constants.h" 11 #include "ui/aura/client/aura_constants.h"
11 #include "ui/aura/env.h" 12 #include "ui/aura/env.h"
12 #include "ui/aura/test/aura_test_utils.h" 13 #include "ui/aura/test/aura_test_utils.h"
13 #include "ui/aura/window_tree_host.h" 14 #include "ui/aura/window_tree_host.h"
14 #include "ui/base/ime/input_method.h" 15 #include "ui/base/ime/input_method.h"
15 #include "ui/chromeos/accessibility_types.h" 16 #include "ui/chromeos/accessibility_types.h"
16 #include "ui/events/test/event_generator.h" 17 #include "ui/events/test/event_generator.h"
(...skipping 558 matching lines...) Expand 10 before | Expand all | Expand 10 after
575 generator.ReleaseKey(ui::VKEY_A, 0); 576 generator.ReleaseKey(ui::VKEY_A, 0);
576 gfx::Rect caret_bounds = GetCaretBounds(); 577 gfx::Rect caret_bounds = GetCaretBounds();
577 EXPECT_FALSE(view_port.Intersects(caret_bounds)); 578 EXPECT_FALSE(view_port.Intersects(caret_bounds));
578 579
579 gfx::Rect new_view_port = GetViewport(); 580 gfx::Rect new_view_port = GetViewport();
580 EXPECT_TRUE(new_view_port.Contains(caret_bounds)); 581 EXPECT_TRUE(new_view_port.Contains(caret_bounds));
581 EXPECT_EQ(caret_bounds.x(), new_view_port.CenterPoint().x()); 582 EXPECT_EQ(caret_bounds.x(), new_view_port.CenterPoint().x());
582 EXPECT_EQ(view_port.y(), new_view_port.y()); 583 EXPECT_EQ(view_port.y(), new_view_port.y());
583 } 584 }
584 585
586 // Make sure that unified desktop can enter magnified mode.
587 TEST_F(MagnificationControllerTest, EnableMagnifierInUnifiedDesktop) {
588 DisplayManager* display_manager = Shell::GetInstance()->display_manager();
589 display_manager->SetDefaultMultiDisplayMode(DisplayManager::UNIFIED);
590 display_manager->SetMultiDisplayMode(DisplayManager::UNIFIED);
591
592 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale());
593
594 GetMagnificationController()->SetEnabled(true);
595
596 gfx::Screen* screen =
597 gfx::Screen::GetScreenFor(Shell::GetPrimaryRootWindow());
598
599 UpdateDisplay("500x500, 500x500");
600 EXPECT_EQ("0,0 1000x500", screen->GetPrimaryDisplay().bounds().ToString());
601 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale());
602
603 GetMagnificationController()->SetEnabled(false);
604
605 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale());
606
607 GetMagnificationController()->SetEnabled(true);
608 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale());
609
610 UpdateDisplay("500x500");
611 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString());
612 EXPECT_EQ(2.0f, GetMagnificationController()->GetScale());
613
614 GetMagnificationController()->SetEnabled(false);
615 EXPECT_EQ("0,0 500x500", screen->GetPrimaryDisplay().bounds().ToString());
616 EXPECT_EQ(1.0f, GetMagnificationController()->GetScale());
617 }
618
585 } // namespace ash 619 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698