| 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 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 49 [outer_dictionary setObject:value_dictionary forKey:@"value"]; | 49 [outer_dictionary setObject:value_dictionary forKey:@"value"]; |
| 50 | 50 |
| 51 NSNumber* enabled_number = [NSNumber numberWithBool:enabled]; | 51 NSNumber* enabled_number = [NSNumber numberWithBool:enabled]; |
| 52 [outer_dictionary setObject:enabled_number forKey:@"enabled"]; | 52 [outer_dictionary setObject:enabled_number forKey:@"enabled"]; |
| 53 | 53 |
| 54 NSString* key = [NSString stringWithFormat:@"%d", count_]; | 54 NSString* key = [NSString stringWithFormat:@"%d", count_]; |
| 55 [system_hotkey_inner_dictionary_ setObject:outer_dictionary forKey:key]; | 55 [system_hotkey_inner_dictionary_ setObject:outer_dictionary forKey:key]; |
| 56 ++count_; | 56 ++count_; |
| 57 } | 57 } |
| 58 | 58 |
| 59 virtual void SetUp() OVERRIDE { | 59 virtual void SetUp() override { |
| 60 system_hotkey_dictionary_.reset([[NSMutableDictionary alloc] init]); | 60 system_hotkey_dictionary_.reset([[NSMutableDictionary alloc] init]); |
| 61 system_hotkey_inner_dictionary_.reset([[NSMutableDictionary alloc] init]); | 61 system_hotkey_inner_dictionary_.reset([[NSMutableDictionary alloc] init]); |
| 62 [system_hotkey_dictionary_ setObject:system_hotkey_inner_dictionary_ | 62 [system_hotkey_dictionary_ setObject:system_hotkey_inner_dictionary_ |
| 63 forKey:@"AppleSymbolicHotKeys"]; | 63 forKey:@"AppleSymbolicHotKeys"]; |
| 64 count_ = 100; | 64 count_ = 100; |
| 65 } | 65 } |
| 66 | 66 |
| 67 virtual void TearDown() OVERRIDE { | 67 virtual void TearDown() override { |
| 68 system_hotkey_dictionary_.reset(); | 68 system_hotkey_dictionary_.reset(); |
| 69 system_hotkey_inner_dictionary_.reset(); | 69 system_hotkey_inner_dictionary_.reset(); |
| 70 } | 70 } |
| 71 | 71 |
| 72 // A constructed dictionary that matches the format of the one that would be | 72 // A constructed dictionary that matches the format of the one that would be |
| 73 // parsed from the system hotkeys plist. | 73 // parsed from the system hotkeys plist. |
| 74 base::scoped_nsobject<NSMutableDictionary> system_hotkey_dictionary_; | 74 base::scoped_nsobject<NSMutableDictionary> system_hotkey_dictionary_; |
| 75 | 75 |
| 76 private: | 76 private: |
| 77 // A reference to the mutable dictionary to which new entries are added. | 77 // A reference to the mutable dictionary to which new entries are added. |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 187 // Disabled entries should not be reserved. | 187 // Disabled entries should not be reserved. |
| 188 EXPECT_FALSE(map.IsHotkeyReserved(key_code, NSAlternateKeyMask)); | 188 EXPECT_FALSE(map.IsHotkeyReserved(key_code, NSAlternateKeyMask)); |
| 189 | 189 |
| 190 // Other entries should be reserved. | 190 // Other entries should be reserved. |
| 191 EXPECT_TRUE(map.IsHotkeyReserved(key_code, NSControlKeyMask)); | 191 EXPECT_TRUE(map.IsHotkeyReserved(key_code, NSControlKeyMask)); |
| 192 EXPECT_TRUE( | 192 EXPECT_TRUE( |
| 193 map.IsHotkeyReserved(key_code, NSFunctionKeyMask | NSControlKeyMask)); | 193 map.IsHotkeyReserved(key_code, NSFunctionKeyMask | NSControlKeyMask)); |
| 194 } | 194 } |
| 195 | 195 |
| 196 } // namespace content | 196 } // namespace content |
| OLD | NEW |