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

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

Issue 10914231: Map fullscreen button to maximize (Closed) Base URL: http://git.chromium.org/chromium/src.git@master
Patch Set: rebase Created 8 years, 3 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 | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | chrome/tools/chromeactions.txt » ('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 <set> 5 #include <set>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "chrome/browser/ui/views/accelerator_table.h" 8 #include "chrome/browser/ui/views/accelerator_table.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 #include "ui/base/events/event_constants.h" 10 #include "ui/base/events/event_constants.h"
(...skipping 25 matching lines...) Expand all
36 EXPECT_TRUE(acclerators.insert(entry).second) 36 EXPECT_TRUE(acclerators.insert(entry).second)
37 << "Duplicated accelerator: " << entry.keycode << ", " 37 << "Duplicated accelerator: " << entry.keycode << ", "
38 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", " 38 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", "
39 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", " 39 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", "
40 << (entry.modifiers & ui::EF_ALT_DOWN); 40 << (entry.modifiers & ui::EF_ALT_DOWN);
41 } 41 }
42 } 42 }
43 43
44 #if defined(USE_ASH) 44 #if defined(USE_ASH)
45 TEST(AcceleratorTableTest, CheckDuplicatedAcceleratorsAsh) { 45 TEST(AcceleratorTableTest, CheckDuplicatedAcceleratorsAsh) {
46 std::set<AcceleratorMapping, Cmp> allowed_duplicates;
47 #if defined(OS_CHROMEOS)
48 AcceleratorMapping exception_entry;
49 // Both Chrome and Ash have a shortcut for F4
50 exception_entry.keycode = ui::VKEY_F4;
51 exception_entry.modifiers = ui::EF_NONE;
52 exception_entry.command_id = 0; // dummy
53 allowed_duplicates.insert(exception_entry);
54 #endif
55
46 std::set<AcceleratorMapping, Cmp> acclerators; 56 std::set<AcceleratorMapping, Cmp> acclerators;
47 for (size_t i = 0; i < kAcceleratorMapLength; ++i) { 57 for (size_t i = 0; i < kAcceleratorMapLength; ++i) {
48 const AcceleratorMapping& entry = kAcceleratorMap[i]; 58 const AcceleratorMapping& entry = kAcceleratorMap[i];
49 acclerators.insert(entry); 59 acclerators.insert(entry);
50 } 60 }
51 for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) { 61 for (size_t i = 0; i < ash::kAcceleratorDataLength; ++i) {
52 const ash::AcceleratorData& ash_entry = ash::kAcceleratorData[i]; 62 const ash::AcceleratorData& ash_entry = ash::kAcceleratorData[i];
53 if (!ash_entry.trigger_on_press) 63 if (!ash_entry.trigger_on_press)
54 continue; // kAcceleratorMap does not have any release accelerators. 64 continue; // kAcceleratorMap does not have any release accelerators.
55 AcceleratorMapping entry; 65 AcceleratorMapping entry;
56 entry.keycode = ash_entry.keycode; 66 entry.keycode = ash_entry.keycode;
57 entry.modifiers = ash_entry.modifiers; 67 entry.modifiers = ash_entry.modifiers;
58 entry.command_id = 0; // dummy 68 entry.command_id = 0; // dummy
59 EXPECT_TRUE(acclerators.insert(entry).second) 69 if (allowed_duplicates.find(entry) == allowed_duplicates.end()) {
60 << "Duplicated accelerator: " << entry.keycode << ", " 70 EXPECT_TRUE(acclerators.insert(entry).second)
61 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", " 71 << "Duplicated accelerator: " << entry.keycode << ", "
62 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", " 72 << (entry.modifiers & ui::EF_SHIFT_DOWN) << ", "
63 << (entry.modifiers & ui::EF_ALT_DOWN); 73 << (entry.modifiers & ui::EF_CONTROL_DOWN) << ", "
74 << (entry.modifiers & ui::EF_ALT_DOWN);
75 }
64 } 76 }
65 } 77 }
66 #endif // USE_ASH 78 #endif // USE_ASH
67 79
68 } // namespace chrome 80 } // namespace chrome
OLDNEW
« no previous file with comments | « chrome/browser/ui/ash/chrome_shell_delegate.cc ('k') | chrome/tools/chromeactions.txt » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698