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

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

Issue 2871243003: Enable new-virtual-keyboard-behavior flag by default. (Closed)
Patch Set: rebase 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
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() { 1818 void DisableNewVKMode() {
1819 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess(); 1819 base::CommandLine* command_line = base::CommandLine::ForCurrentProcess();
1820 if (!command_line->HasSwitch(::switches::kUseNewVirtualKeyboardBehavior)) 1820 if (!command_line->HasSwitch(
1821 command_line->AppendSwitch(::switches::kUseNewVirtualKeyboardBehavior); 1821 ::switches::kDisableNewVirtualKeyboardBehavior)) {
1822 command_line->AppendSwitch(
1823 ::switches::kDisableNewVirtualKeyboardBehavior);
1824 }
1822 } 1825 }
1823 1826
1824 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; } 1827 const gfx::Rect& keyboard_bounds() const { return keyboard_bounds_; }
1825 1828
1826 private: 1829 private:
1827 gfx::Rect keyboard_bounds_; 1830 gfx::Rect keyboard_bounds_;
1828 1831
1829 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerKeyboardTest); 1832 DISALLOW_COPY_AND_ASSIGN(ShelfLayoutManagerKeyboardTest);
1830 }; 1833 };
1831 1834
1832 TEST_F(ShelfLayoutManagerKeyboardTest, ShelfChangeWorkAreaInNonStickyMode) { 1835 TEST_F(ShelfLayoutManagerKeyboardTest, ShelfChangeWorkAreaInNonStickyMode) {
1836 // Append the flag to cause work area change in non-sticky mode.
1837 DisableNewVKMode();
oshima 2017/05/16 12:31:30 you can just add a flag here.
yhanada 2017/05/17 01:33:37 Done.
1838
1833 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); 1839 ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
1834 keyboard::SetAccessibilityKeyboardEnabled(true); 1840 keyboard::SetAccessibilityKeyboardEnabled(true);
1835 InitKeyboardBounds(); 1841 InitKeyboardBounds();
1836 Shell::Get()->CreateKeyboard(); 1842 Shell::Get()->CreateKeyboard();
1837 keyboard::KeyboardController* kb_controller = 1843 keyboard::KeyboardController* kb_controller =
1838 keyboard::KeyboardController::GetInstance(); 1844 keyboard::KeyboardController::GetInstance();
1839 gfx::Rect orig_work_area( 1845 gfx::Rect orig_work_area(
1840 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1846 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1841 1847
1842 // Open keyboard in non-sticky mode. 1848 // Open keyboard in non-sticky mode.
(...skipping 16 matching lines...) Expand all
1859 1865
1860 // Work area should be changed. 1866 // Work area should be changed.
1861 EXPECT_NE(orig_work_area, 1867 EXPECT_NE(orig_work_area,
1862 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1868 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1863 } 1869 }
1864 1870
1865 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility 1871 // When kAshUseNewVKWindowBehavior flag enabled, do not change accessibility
1866 // keyboard work area in non-sticky mode. 1872 // keyboard work area in non-sticky mode.
1867 TEST_F(ShelfLayoutManagerKeyboardTest, 1873 TEST_F(ShelfLayoutManagerKeyboardTest,
1868 ShelfIgnoreWorkAreaChangeInNonStickyMode) { 1874 ShelfIgnoreWorkAreaChangeInNonStickyMode) {
1869 // Append flag to ignore work area change in non-sticky mode.
1870 EnableNewVKMode();
1871
1872 ShelfLayoutManager* layout_manager = GetShelfLayoutManager(); 1875 ShelfLayoutManager* layout_manager = GetShelfLayoutManager();
1873 InitKeyboardBounds(); 1876 InitKeyboardBounds();
1874 Shell::Get()->CreateKeyboard(); 1877 Shell::Get()->CreateKeyboard();
1875 keyboard::KeyboardController* kb_controller = 1878 keyboard::KeyboardController* kb_controller =
1876 keyboard::KeyboardController::GetInstance(); 1879 keyboard::KeyboardController::GetInstance();
1877 gfx::Rect orig_work_area( 1880 gfx::Rect orig_work_area(
1878 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1881 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1879 1882
1880 // Open keyboard in non-sticky mode. 1883 // Open keyboard in non-sticky mode.
1881 kb_controller->ShowKeyboard(false); 1884 kb_controller->ShowKeyboard(false);
(...skipping 12 matching lines...) Expand all
1894 // Open keyboard in sticky mode. 1897 // Open keyboard in sticky mode.
1895 kb_controller->ShowKeyboard(true); 1898 kb_controller->ShowKeyboard(true);
1896 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds()); 1899 layout_manager->OnKeyboardBoundsChanging(keyboard_bounds());
1897 1900
1898 // Work area should be changed. 1901 // Work area should be changed.
1899 EXPECT_NE(orig_work_area, 1902 EXPECT_NE(orig_work_area,
1900 display::Screen::GetScreen()->GetPrimaryDisplay().work_area()); 1903 display::Screen::GetScreen()->GetPrimaryDisplay().work_area());
1901 } 1904 }
1902 1905
1903 } // namespace ash 1906 } // namespace ash
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698