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

Side by Side Diff: chrome/browser/ui/views/accelerator_table_unittest.cc

Issue 2128243003: Make most browser accelerators not repeat. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include <set> 7 #include <set>
8 8
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/ui/views/accelerator_table.h" 10 #include "chrome/browser/ui/views/accelerator_table.h"
(...skipping 27 matching lines...) Expand all
38 accelerator_list.begin(); it != accelerator_list.end(); ++it) { 38 accelerator_list.begin(); it != accelerator_list.end(); ++it) {
39 const AcceleratorMapping& entry = *it; 39 const AcceleratorMapping& entry = *it;
40 EXPECT_TRUE(accelerators.insert(entry).second) 40 EXPECT_TRUE(accelerators.insert(entry).second)
41 << "Duplicated accelerator: " << entry.keycode << ", " 41 << "Duplicated accelerator: " << entry.keycode << ", "
42 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", " 42 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", "
43 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", " 43 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", "
44 << (entry.modifiers & ui::EF_ALT_DOWN); 44 << (entry.modifiers & ui::EF_ALT_DOWN);
45 } 45 }
46 } 46 }
47 47
48 TEST(AcceleratorTableTest, CheckDuplicatedRepeatableCommandIds) {
49 std::set<int> commands;
50 const std::vector<int> command_list(GetRepeatableCommandIds());
51 for (int command : command_list) {
52 EXPECT_TRUE(commands.insert(command).second)
53 << "Duplicated command ID " << command;
54 }
55 }
56
48 #if defined(OS_CHROMEOS) 57 #if defined(OS_CHROMEOS)
49 TEST(AcceleratorTableTest, CheckDuplicatedAcceleratorsAsh) { 58 TEST(AcceleratorTableTest, CheckDuplicatedAcceleratorsAsh) {
50 std::set<AcceleratorMapping, Cmp> accelerators; 59 std::set<AcceleratorMapping, Cmp> accelerators;
51 const std::vector<AcceleratorMapping> accelerator_list(GetAcceleratorList()); 60 const std::vector<AcceleratorMapping> accelerator_list(GetAcceleratorList());
52 for (std::vector<AcceleratorMapping>::const_iterator it = 61 for (std::vector<AcceleratorMapping>::const_iterator it =
53 accelerator_list.begin(); it != accelerator_list.end(); ++it) { 62 accelerator_list.begin(); it != accelerator_list.end(); ++it) {
54 const AcceleratorMapping& entry = *it; 63 const AcceleratorMapping& entry = *it;
55 accelerators.insert(entry); 64 accelerators.insert(entry);
56 } 65 }
57 for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) { 66 for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) {
(...skipping 16 matching lines...) Expand all
74 EXPECT_TRUE(accelerators.insert(entry).second) 83 EXPECT_TRUE(accelerators.insert(entry).second)
75 << "Duplicated accelerator: " << entry.keycode << ", " 84 << "Duplicated accelerator: " << entry.keycode << ", "
76 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", " 85 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", "
77 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", " 86 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", "
78 << (entry.modifiers & ui::EF_ALT_DOWN); 87 << (entry.modifiers & ui::EF_ALT_DOWN);
79 } 88 }
80 } 89 }
81 #endif // USE_ASH 90 #endif // USE_ASH
82 91
83 } // namespace chrome 92 } // namespace chrome
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698