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

Side by Side Diff: ash/accelerators/accelerator_table_unittest.cc

Issue 1177773002: Deprecating high-conflict accelerators (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: oshima's comments Created 5 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 | « ash/accelerators/accelerator_table.cc ('k') | ash/ash_chromeos_strings.grdp » ('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 "ash/accelerators/accelerator_table.h" 8 #include "ash/accelerators/accelerator_table.h"
9 #include "testing/gtest/include/gtest/gtest.h" 9 #include "testing/gtest/include/gtest/gtest.h"
10 10
(...skipping 58 matching lines...) Expand 10 before | Expand all | Expand 10 after
69 69
70 TEST(AcceleratorTableTest, CheckDuplicatedNonrepeatableActions) { 70 TEST(AcceleratorTableTest, CheckDuplicatedNonrepeatableActions) {
71 std::set<AcceleratorAction> actions; 71 std::set<AcceleratorAction> actions;
72 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) { 72 for (size_t i = 0; i < kNonrepeatableActionsLength; ++i) {
73 EXPECT_TRUE(actions.insert(kNonrepeatableActions[i]).second) 73 EXPECT_TRUE(actions.insert(kNonrepeatableActions[i]).second)
74 << "Duplicated action: " << kNonrepeatableActions[i] 74 << "Duplicated action: " << kNonrepeatableActions[i]
75 << " at index: " << i; 75 << " at index: " << i;
76 } 76 }
77 } 77 }
78 78
79 #if defined(OS_CHROMEOS)
80
81 TEST(AcceleratorTableTest, CheckDeprecatedAccelerators) {
82 std::set<AcceleratorAction> deprecated_actions;
83 for (size_t i = 0; i < kDeprecatedAcceleratorsLength; ++i) {
84 // A deprecated action can never appear twice in the list.
85 AcceleratorAction deprecated_action =
86 kDeprecatedAccelerators[i].deprecated_accelerator.action;
87 EXPECT_TRUE(deprecated_actions.insert(deprecated_action).second)
88 << "Duplicated action: " << deprecated_action << " at index: " << i;
89
90 // The UMA histogram name must be of the format "Ash.Accelerators.*"
91 std::string uma_histogram(kDeprecatedAccelerators[i].uma_histogram_name);
92 EXPECT_TRUE(uma_histogram.find("Ash.Accelerators.") != std::string::npos);
93 EXPECT_TRUE(uma_histogram.find("Ash.Accelerators.") == 0);
94 }
95 }
96
97 #endif // defined(OS_CHROMEOS)
98
79 } // namespace ash 99 } // namespace ash
OLDNEW
« no previous file with comments | « ash/accelerators/accelerator_table.cc ('k') | ash/ash_chromeos_strings.grdp » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698