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

Side by Side Diff: ash/shelf/shelf_layout_manager_unittest.cc

Issue 2871243003: Enable new-virtual-keyboard-behavior flag by default. (Closed)
Patch Set: keep sorted the declarations Created 3 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
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/wm/workspace/workspace_layout_manager.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/shelf/shelf_layout_manager.h" 5 #include "ash/shelf/shelf_layout_manager.h"
6 6
7 #include "ash/accelerators/accelerator_controller.h" 7 #include "ash/accelerators/accelerator_controller.h"
8 #include "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "ash/focus_cycler.h" 9 #include "ash/focus_cycler.h"
10 #include "ash/public/cpp/config.h" 10 #include "ash/public/cpp/config.h"
(...skipping 1797 matching lines...) Expand 10 before | Expand all | Expand 10 after
1808 } 1808 }
1809 1809
1810 void InitKeyboardBounds() { 1810 void InitKeyboardBounds() {
1811 gfx::Rect work_area( 1811 gfx::Rect work_area(
1812 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1812 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1813 keyboard_bounds_.SetRect(work_area.x(), 1813 keyboard_bounds_.SetRect(work_area.x(),
1814 work_area.y() + work_area.height() / 2, 1814 work_area.y() + work_area.height() / 2,
1815 work_area.width(), work_area.height() / 2); 1815 work_area.width(), work_area.height() / 2);
1816 } 1816 }
1817 1817
1818 void EnableNewVKMode() {
1819 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1820 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior))
1821 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior);
1822 }
1823
1824 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; } 1818 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; }
1825 1819
1826 private: 1820 private:
1827 gfx::Rect keyboard_bounds_; 1821 gfx::Rect keyboard_bounds_;
1828 1822
1829 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerKeyboardTest); 1823 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerKeyboardTest);
1830 }; 1824 };
1831 1825
1832 TEST_F(ShelfLayoutManagerKeyboardTest, ShelfChangeWorkAreaInNonStickyMode) { 1826 TEST_F(ShelfLayoutManagerKeyboardTest, ShelfChangeWorkAreaInNonStickyMode) {
1827 // Append the flag to cause work area change in non-sticky mode.
1828 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1829 command_line->AppendSwitch(::switches::kDisableNewVirtualKeyboardBehavior);
1830
1833 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); 1831 ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
1834 keyboard::SetAccessibilityKeyboardEnabled(true); 1832 keyboard::SetAccessibilityKeyboardEnabled(true);
1835 InitKeyboardBounds(); 1833 InitKeyboardBounds();
1836 Shell::Get()->CreateKeyboard(); 1834 Shell::Get()->CreateKeyboard();
1837 keyboard::KeyboardController* kb_controller = 1835 keyboard::KeyboardController* kb_controller =
1838 keyboard::KeyboardController::GetInstance(); 1836 keyboard::KeyboardController::GetInstance();
1839 gfx::Rect orig_work_area( 1837 gfx::Rect orig_work_area(
1840 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1838 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1841 1839
1842 // Open keyboard in non-sticky mode. 1840 // Open keyboard in non-sticky mode.
(...skipping 16 matching lines...) Expand all
1859 1857
1860 // Work area should be changed. 1858 // Work area should be changed.
1861 EXPECT_NE(orig_work_area, 1859 EXPECT_NE(orig_work_area,
1862 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1860 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1863 } 1861 }
1864 1862
1865 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility 1863 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility
1866 // keyboard work area in non-sticky mode. 1864 // keyboard work area in non-sticky mode.
1867 TEST_F(ShelfLayoutManagerKeyboardTest, 1865 TEST_F(ShelfLayoutManagerKeyboardTest,
1868 ShelfIgnoreWorkAreaChangeInNonStickyMode) { 1866 ShelfIgnoreWorkAreaChangeInNonStickyMode) {
1869 // Append flag to ignore work area change in non-sticky mode.
1870 EnableNewVKMode();
1871
1872 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); 1867 ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
1873 InitKeyboardBounds(); 1868 InitKeyboardBounds();
1874 Shell::Get()->CreateKeyboard(); 1869 Shell::Get()->CreateKeyboard();
1875 keyboard::KeyboardController* kb_controller = 1870 keyboard::KeyboardController* kb_controller =
1876 keyboard::KeyboardController::GetInstance(); 1871 keyboard::KeyboardController::GetInstance();
1877 gfx::Rect orig_work_area( 1872 gfx::Rect orig_work_area(
1878 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1873 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1879 1874
1880 // Open keyboard in non-sticky mode. 1875 // Open keyboard in non-sticky mode.
1881 kb_controller->ShowKeyboard(false); 1876 kb_controller->ShowKeyboard(false);
(...skipping 12 matching lines...) Expand all
1894 // Open keyboard in sticky mode. 1889 // Open keyboard in sticky mode.
1895 kb_controller->ShowKeyboard(true); 1890 kb_controller->ShowKeyboard(true);
1896 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1891 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1897 1892
1898 // Work area should be changed. 1893 // Work area should be changed.
1899 EXPECT_NE(orig_work_area, 1894 EXPECT_NE(orig_work_area,
1900 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1895 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1901 } 1896 }
1902 1897
1903 } // namespace ash 1898 } // namespace ash
OLDNEW
« no previous file with comments | « ash/shelf/shelf_layout_manager.cc ('k') | ash/wm/workspace/workspace_layout_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698