| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
| 6 | 6 |
| 7 #import <Carbon/Carbon.h> | 7 #import <Carbon/Carbon.h> |
| 8 #import <Cocoa/Cocoa.h> | 8 #import <Cocoa/Cocoa.h> |
| 9 | 9 |
| 10 #import "chrome/browser/ui/cocoa/system_hotkey_map.h" | 10 #import "chrome/browser/ui/cocoa/system_hotkey_map.h" |
| 11 #include "chrome/test/base/ui_test_utils.h" | 11 #include "chrome/test/base/ui_test_utils.h" |
| 12 | 12 |
| 13 namespace { | |
| 14 | |
| 15 class SystemHotkeyMapTest : public ::testing::Test { | 13 class SystemHotkeyMapTest : public ::testing::Test { |
| 16 public: | 14 public: |
| 17 SystemHotkeyMapTest() {} | 15 SystemHotkeyMapTest() {} |
| 18 }; | 16 }; |
| 19 | 17 |
| 20 TEST_F(SystemHotkeyMapTest, Parse) { | 18 TEST_F(SystemHotkeyMapTest, Parse) { |
| 21 std::string path = ui_test_utils::GetTestUrl( | 19 std::string path = ui_test_utils::GetTestUrl( |
| 22 base::FilePath(base::FilePath::kCurrentDirectory), | 20 base::FilePath(base::FilePath::kCurrentDirectory), |
| 23 base::FilePath("mac/mac_system_hotkeys.plist")).path(); | 21 base::FilePath("mac/mac_system_hotkeys.plist")).path(); |
| 24 NSString* file_path = [NSString stringWithUTF8String:path.c_str()]; | 22 NSString* file_path = [NSString stringWithUTF8String:path.c_str()]; |
| (...skipping 16 matching lines...) Expand all Loading... |
| 41 // Command + Shift + Ctr + ` is not a common key binding. | 39 // Command + Shift + Ctr + ` is not a common key binding. |
| 42 modifiers = NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask; | 40 modifiers = NSCommandKeyMask | NSShiftKeyMask | NSControlKeyMask; |
| 43 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); | 41 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); |
| 44 | 42 |
| 45 // Command + L is not a common key binding. | 43 // Command + L is not a common key binding. |
| 46 key_code = kVK_ANSI_L; | 44 key_code = kVK_ANSI_L; |
| 47 modifiers = NSCommandKeyMask; | 45 modifiers = NSCommandKeyMask; |
| 48 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); | 46 EXPECT_FALSE(map.IsHotkeyReserved(key_code, modifiers)); |
| 49 } | 47 } |
| 50 | 48 |
| 51 } // namespace | 49 TEST_F(SystemHotkeyMapTest, ParseNil) { |
| 50 NSData* data = nil; |
| 51 |
| 52 SystemHotkeyMap map; |
| 53 bool result = map.ParseData(data); |
| 54 EXPECT_FALSE(result); |
| 55 } |
| OLD | NEW |