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

Side by Side Diff: ash/virtual_keyboard_controller_unittest.cc

Issue 703703004: Fix infinite loop causing iterator to go out of bounds. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Add unittest. Created 6 years, 1 month 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/virtual_keyboard_controller.h" 5 #include "ash/virtual_keyboard_controller.h"
6 6
7 #include "ash/shell.h" 7 #include "ash/shell.h"
8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h" 8 #include "ash/system/chromeos/virtual_keyboard/virtual_keyboard_observer.h"
9 #include "ash/test/ash_test_base.h" 9 #include "ash/test/ash_test_base.h"
10 #include "ash/wm/maximize_mode/maximize_mode_controller.h" 10 #include "ash/wm/maximize_mode/maximize_mode_controller.h"
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after
178 ASSERT_TRUE(IsVirtualKeyboardSuppressed()); 178 ASSERT_TRUE(IsVirtualKeyboardSuppressed());
179 // Remove external keyboard. Should be notified that the keyboard is not 179 // Remove external keyboard. Should be notified that the keyboard is not
180 // suppressed. 180 // suppressed.
181 ResetObserver(); 181 ResetObserver();
182 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>()); 182 UpdateKeyboardDevices(std::vector<ui::KeyboardDevice>());
183 ASSERT_TRUE(keyboard::IsKeyboardEnabled()); 183 ASSERT_TRUE(keyboard::IsKeyboardEnabled());
184 ASSERT_TRUE(notified()); 184 ASSERT_TRUE(notified());
185 ASSERT_FALSE(IsVirtualKeyboardSuppressed()); 185 ASSERT_FALSE(IsVirtualKeyboardSuppressed());
186 } 186 }
187 187
188 // Tests handling multiple keyboards. Catches crbug.com/430252
189 TEST_F(VirtualKeyboardControllerAutoTest, HandleMultipleKeyboardsPresent) {
190 std::vector<ui::KeyboardDevice> keyboards;
191 keyboards.push_back(ui::KeyboardDevice(
192 1, ui::InputDeviceType::INPUT_DEVICE_INTERNAL, "keyboard"));
193 keyboards.push_back(ui::KeyboardDevice(
194 2, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
195 keyboards.push_back(ui::KeyboardDevice(
196 3, ui::InputDeviceType::INPUT_DEVICE_EXTERNAL, "keyboard"));
197 UpdateKeyboardDevices(keyboards);
198 ASSERT_FALSE(keyboard::IsKeyboardEnabled());
199 }
200
188 } // namespace test 201 } // namespace test
189 } // namespace ash 202 } // namespace ash
OLDNEW
« ash/virtual_keyboard_controller.cc ('K') | « ash/virtual_keyboard_controller.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698