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

Side by Side Diff: chrome/browser/chromeos/events/event_rewriter_unittest.cc

Issue 1269793005: Remove the no-longer-used chromeos::switches::kHasChromeOSKeyboard (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/chrome_restart_request.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 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 "chrome/browser/chromeos/events/event_rewriter.h" 5 #include "chrome/browser/chromeos/events/event_rewriter.h"
6 6
7 #include <vector> 7 #include <vector>
8 8
9 #include "ash/shell.h" 9 #include "ash/shell.h"
10 #include "ash/sticky_keys/sticky_keys_controller.h" 10 #include "ash/sticky_keys/sticky_keys_controller.h"
(...skipping 2549 matching lines...) Expand 10 before | Expand all | Expand 10 after
2560 ui::DomKey::F12, 2560 ui::DomKey::F12,
2561 0}, 2561 0},
2562 {ui::VKEY_F12, ui::DomCode::F12, ui::EF_NONE, ui::DomKey::F12, 0}}}; 2562 {ui::VKEY_F12, ui::DomCode::F12, ui::EF_NONE, ui::DomKey::F12, 0}}};
2563 2563
2564 for (const auto& test : tests) { 2564 for (const auto& test : tests) {
2565 CheckKeyTestCase(&rewriter, test); 2565 CheckKeyTestCase(&rewriter, test);
2566 } 2566 }
2567 } 2567 }
2568 2568
2569 TEST_F(EventRewriterTest, TestRewriteExtendedKeysWithSearchRemapped) { 2569 TEST_F(EventRewriterTest, TestRewriteExtendedKeysWithSearchRemapped) {
2570 const base::CommandLine original_cl(*base::CommandLine::ForCurrentProcess());
2571
2572 // Remap Search to Control. 2570 // Remap Search to Control.
2573 TestingPrefServiceSyncable prefs; 2571 TestingPrefServiceSyncable prefs;
2574 chromeos::Preferences::RegisterProfilePrefs(prefs.registry()); 2572 chromeos::Preferences::RegisterProfilePrefs(prefs.registry());
2575 IntegerPrefMember search; 2573 IntegerPrefMember search;
2576 search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs); 2574 search.Init(prefs::kLanguageRemapSearchKeyTo, &prefs);
2577 search.SetValue(chromeos::input_method::kControlKey); 2575 search.SetValue(chromeos::input_method::kControlKey);
2578 2576
2579 EventRewriter rewriter(NULL); 2577 EventRewriter rewriter(NULL);
2580 rewriter.KeyboardDeviceAddedForTesting(kKeyboardDeviceId, "PC Keyboard"); 2578 rewriter.KeyboardDeviceAddedForTesting(kKeyboardDeviceId, "PC Keyboard");
2581 rewriter.set_pref_service_for_testing(&prefs); 2579 rewriter.set_pref_service_for_testing(&prefs);
2582 2580
2583 base::CommandLine::ForCurrentProcess()->AppendSwitchASCII(
2584 chromeos::switches::kHasChromeOSKeyboard, "");
2585
2586 KeyTestCase tests[] = { 2581 KeyTestCase tests[] = {
2587 // Alt+Search+Down -> End 2582 // Alt+Search+Down -> End
2588 {ui::ET_KEY_PRESSED, 2583 {ui::ET_KEY_PRESSED,
2589 {ui::VKEY_DOWN, 2584 {ui::VKEY_DOWN,
2590 ui::DomCode::ARROW_DOWN, 2585 ui::DomCode::ARROW_DOWN,
2591 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN, 2586 ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN,
2592 ui::DomKey::ARROW_DOWN, 2587 ui::DomKey::ARROW_DOWN,
2593 0}, 2588 0},
2594 {ui::VKEY_END, ui::DomCode::END, ui::EF_NONE, ui::DomKey::END, 0}}, 2589 {ui::VKEY_END, ui::DomCode::END, ui::EF_NONE, ui::DomKey::END, 0}},
2595 2590
2596 // Shift+Alt+Search+Down -> Shift+End 2591 // Shift+Alt+Search+Down -> Shift+End
2597 {ui::ET_KEY_PRESSED, 2592 {ui::ET_KEY_PRESSED,
2598 {ui::VKEY_DOWN, 2593 {ui::VKEY_DOWN,
2599 ui::DomCode::ARROW_DOWN, 2594 ui::DomCode::ARROW_DOWN,
2600 ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN, 2595 ui::EF_SHIFT_DOWN | ui::EF_ALT_DOWN | ui::EF_COMMAND_DOWN,
2601 ui::DomKey::ARROW_DOWN, 2596 ui::DomKey::ARROW_DOWN,
2602 0}, 2597 0},
2603 {ui::VKEY_END, ui::DomCode::END, ui::EF_SHIFT_DOWN, ui::DomKey::END, 0}}, 2598 {ui::VKEY_END, ui::DomCode::END, ui::EF_SHIFT_DOWN, ui::DomKey::END, 0}},
2604 }; 2599 };
2605 2600
2606 for (const auto& test : tests) { 2601 for (const auto& test : tests) {
2607 CheckKeyTestCase(&rewriter, test); 2602 CheckKeyTestCase(&rewriter, test);
2608 } 2603 }
2609
2610 *base::CommandLine::ForCurrentProcess() = original_cl;
2611 } 2604 }
2612 2605
2613 TEST_F(EventRewriterTest, TestRewriteKeyEventSentByXSendEvent) { 2606 TEST_F(EventRewriterTest, TestRewriteKeyEventSentByXSendEvent) {
2614 // Remap Control to Alt. 2607 // Remap Control to Alt.
2615 TestingPrefServiceSyncable prefs; 2608 TestingPrefServiceSyncable prefs;
2616 chromeos::Preferences::RegisterProfilePrefs(prefs.registry()); 2609 chromeos::Preferences::RegisterProfilePrefs(prefs.registry());
2617 IntegerPrefMember control; 2610 IntegerPrefMember control;
2618 control.Init(prefs::kLanguageRemapControlKeyTo, &prefs); 2611 control.Init(prefs::kLanguageRemapControlKeyTo, &prefs);
2619 control.SetValue(chromeos::input_method::kAltKey); 2612 control.SetValue(chromeos::input_method::kAltKey);
2620 2613
(...skipping 797 matching lines...) Expand 10 before | Expand all | Expand 10 after
3418 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 3411 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
3419 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 3412 EXPECT_TRUE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
3420 3413
3421 // Turn off AltGr and Mod3. 3414 // Turn off AltGr and Mod3.
3422 sticky_keys_controller_->SetModifiersEnabled(false, false); 3415 sticky_keys_controller_->SetModifiersEnabled(false, false);
3423 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN)); 3416 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_ALTGR_DOWN));
3424 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN)); 3417 EXPECT_FALSE(overlay_->GetModifierVisible(ui::EF_MOD3_DOWN));
3425 } 3418 }
3426 3419
3427 } // namespace chromeos 3420 } // namespace chromeos
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/login/chrome_restart_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698