Chromium Code Reviews| OLD | NEW |
|---|---|
| 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 Loading... | |
| 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 TEST(AcceleratorTableTest, CheckDeprecatedAccelerators) { | |
| 80 std::set<AcceleratorAction> non_deprecated_actions; | |
| 81 for (size_t i = 0; i < kAcceleratorDataLength; ++i) { | |
| 82 non_deprecated_actions.insert(kAcceleratorData[i].action); | |
| 83 } | |
|
oshima
2015/06/16 05:54:17
nuke {}
afakhry
2015/06/16 22:30:33
Done.
| |
| 84 | |
| 85 // 1- A deprecated action can never be part of the non-deprecated actions. | |
| 86 // 2- A new accelerator replacing a deprecated one must be mapped to the same | |
| 87 // action. | |
| 88 for (size_t i = 0; i < kDeprecatedAcceleratorsLength; ++i) { | |
| 89 AcceleratorAction deprecated_action = | |
| 90 kDeprecatedAccelerators[i].deprecated_accelerator.action; | |
| 91 EXPECT_FALSE(non_deprecated_actions.count(deprecated_action)); | |
| 92 | |
| 93 AcceleratorAction new_action = | |
| 94 kDeprecatedAccelerators[i].new_accelerator.action; | |
| 95 EXPECT_EQ(deprecated_action, new_action); | |
| 96 } | |
| 97 } | |
| 98 | |
| 79 } // namespace ash | 99 } // namespace ash |
| OLD | NEW |