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 "chrome/common/extensions/extension.h" | 5 #include "chrome/common/extensions/extension.h" |
6 | 6 |
7 #include "base/format_macros.h" | 7 #include "base/format_macros.h" |
8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
10 #include "base/json/json_file_value_serializer.h" | 10 #include "base/json/json_file_value_serializer.h" |
(...skipping 952 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
963 { true, CtrlF, "command", "F+Ctrl", "description" }, | 963 { true, CtrlF, "command", "F+Ctrl", "description" }, |
964 { true, ShiftF, "command", "F+Shift", "description" }, | 964 { true, ShiftF, "command", "F+Shift", "description" }, |
965 { true, AltF, "command", "F+Alt", "description" }, | 965 { true, AltF, "command", "F+Alt", "description" }, |
966 { true, CtrlShiftF, "command", "F+Ctrl+Shift", "description" }, | 966 { true, CtrlShiftF, "command", "F+Ctrl+Shift", "description" }, |
967 { true, CtrlShiftF, "command", "F+Shift+Ctrl", "description" }, | 967 { true, CtrlShiftF, "command", "F+Shift+Ctrl", "description" }, |
968 { true, AltShiftF, "command", "F+Alt+Shift", "description" }, | 968 { true, AltShiftF, "command", "F+Alt+Shift", "description" }, |
969 { true, AltShiftF, "command", "F+Shift+Alt", "description" }, | 969 { true, AltShiftF, "command", "F+Shift+Alt", "description" }, |
970 // Case insensitivity is OK. | 970 // Case insensitivity is OK. |
971 { true, CtrlF, "command", "Ctrl+F", "description" }, | 971 { true, CtrlF, "command", "Ctrl+F", "description" }, |
972 { true, CtrlF, "command", "cTrL+f", "description" }, | 972 { true, CtrlF, "command", "cTrL+f", "description" }, |
973 // Extra spaces are fine. | |
974 { true, CtrlShiftF, "command", " Ctrl + Shift +F", "description" }, | |
975 // Minus is equivalent to plus. | |
976 { true, CtrlShiftF, "command", "Ctrl+Shift-F", "description" }, | |
977 // Skipping description is OK for browser- and pageActions. | 973 // Skipping description is OK for browser- and pageActions. |
978 { true, CtrlF, "browserAction", "Ctrl+F", "" }, | 974 { true, CtrlF, "_execute_browser_action", "Ctrl+F", "" }, |
979 { true, CtrlF, "pageAction", "Ctrl+F", "" }, | 975 { true, CtrlF, "_execute_page_action", "Ctrl+F", "" }, |
980 }; | 976 }; |
981 | 977 |
982 // TODO(finnur): test Command/Options on Mac when implemented. | 978 // TODO(finnur): test Command/Options on Mac when implemented. |
983 | 979 |
984 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { | 980 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(kTests); ++i) { |
985 scoped_ptr<DictionaryValue> command(new DictionaryValue); | 981 scoped_ptr<DictionaryValue> command(new DictionaryValue); |
986 command->SetString("key", kTests[i].key); | 982 command->SetString("suggested_key_win", kTests[i].key); |
| 983 command->SetString("suggested_key_mac", kTests[i].key); |
| 984 command->SetString("suggested_key_other", kTests[i].key); |
987 command->SetString("description", kTests[i].description); | 985 command->SetString("description", kTests[i].description); |
988 | 986 |
989 Extension::ExtensionKeybinding keybinding; | 987 Extension::ExtensionKeybinding keybinding; |
990 string16 error; | 988 string16 error; |
991 bool result = | 989 bool result = |
992 keybinding.Parse(command.get(), kTests[i].command_name, i, &error); | 990 keybinding.Parse(command.get(), kTests[i].command_name, i, &error); |
993 | 991 |
994 SCOPED_TRACE(std::string("Command name: |") + kTests[i].command_name + | 992 SCOPED_TRACE(std::string("Command name: |") + kTests[i].command_name + |
995 "| key: |" + kTests[i].key + | 993 "| key: |" + kTests[i].key + |
996 "| description: |" + kTests[i].description + | 994 "| description: |" + kTests[i].description + |
(...skipping 20 matching lines...) Expand all Loading... |
1017 } | 1015 } |
1018 | 1016 |
1019 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) { | 1017 TEST(ExtensionTest, GetSyncTypeExtensionWithTwoPlugins) { |
1020 scoped_refptr<Extension> extension( | 1018 scoped_refptr<Extension> extension( |
1021 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), | 1019 MakeSyncTestExtension(EXTENSION, GURL(), GURL(), |
1022 Extension::INTERNAL, 2, FilePath())); | 1020 Extension::INTERNAL, 2, FilePath())); |
1023 if (extension) | 1021 if (extension) |
1024 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); | 1022 EXPECT_EQ(extension->GetSyncType(), Extension::SYNC_TYPE_NONE); |
1025 } | 1023 } |
1026 #endif // !defined(OS_CHROMEOS) | 1024 #endif // !defined(OS_CHROMEOS) |
OLD | NEW |