OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #import "ios/chrome/browser/ui/keyboard/hardware_keyboard_watcher.h" | 5 #import "ios/chrome/browser/ui/keyboard/hardware_keyboard_watcher.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/test/histogram_tester.h" | 8 #include "base/test/histogram_tester.h" |
9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
11 #import "third_party/ocmock/OCMock/OCMock.h" | 11 #import "third_party/ocmock/OCMock/OCMock.h" |
12 | 12 |
| 13 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 14 #error "This file requires ARC support." |
| 15 #endif |
| 16 |
13 namespace { | 17 namespace { |
14 | 18 |
15 void PostKeyboardWillChangeNotification(CGRect beginFrame, CGRect endFrame) { | 19 void PostKeyboardWillChangeNotification(CGRect beginFrame, CGRect endFrame) { |
16 [[NSNotificationCenter defaultCenter] | 20 [[NSNotificationCenter defaultCenter] |
17 postNotificationName:UIKeyboardWillChangeFrameNotification | 21 postNotificationName:UIKeyboardWillChangeFrameNotification |
18 object:nil | 22 object:nil |
19 userInfo:@{ | 23 userInfo:@{ |
20 UIKeyboardFrameBeginUserInfoKey : | 24 UIKeyboardFrameBeginUserInfoKey : |
21 [NSValue valueWithCGRect:beginFrame], | 25 [NSValue valueWithCGRect:beginFrame], |
22 UIKeyboardFrameEndUserInfoKey : | 26 UIKeyboardFrameEndUserInfoKey : |
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 [[HardwareKeyboardWatcher alloc] initWithAccessoryView:mockView]); | 113 [[HardwareKeyboardWatcher alloc] initWithAccessoryView:mockView]); |
110 | 114 |
111 PostKeyboardWillChangeNotification(CGRectMake(0, -50, 100, 100), | 115 PostKeyboardWillChangeNotification(CGRectMake(0, -50, 100, 100), |
112 CGRectMake(0, 0, 100, 100)); | 116 CGRectMake(0, 0, 100, 100)); |
113 | 117 |
114 histogram_tester.ExpectUniqueSample("Omnibox.HardwareKeyboardModeEnabled", | 118 histogram_tester.ExpectUniqueSample("Omnibox.HardwareKeyboardModeEnabled", |
115 true, 1); | 119 true, 1); |
116 } | 120 } |
117 | 121 |
118 } // namespace | 122 } // namespace |
OLD | NEW |