| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <Cocoa/Cocoa.h> | 5 #import <Cocoa/Cocoa.h> |
| 6 | 6 |
| 7 #import "base/mac/cocoa_protocols.h" | 7 #import "base/mac/cocoa_protocols.h" |
| 8 #include "base/memory/scoped_nsobject.h" | 8 #include "base/memory/scoped_nsobject.h" |
| 9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" | 9 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field.h" |
| 10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" | 10 #import "chrome/browser/ui/cocoa/find_bar/find_bar_text_field_cell.h" |
| 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 11 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
| 13 #include "testing/platform_test.h" | 13 #include "testing/platform_test.h" |
| 14 #import "third_party/ocmock/OCMock/OCMock.h" | |
| 15 | |
| 16 // OCMock wants to mock a concrete class or protocol. This should | |
| 17 // provide a correct protocol for newer versions of the SDK, while | |
| 18 // providing something mockable for older versions. | |
| 19 | |
| 20 @protocol MockTextEditingDelegate<NSControlTextEditingDelegate> | |
| 21 - (void)controlTextDidBeginEditing:(NSNotification*)aNotification; | |
| 22 - (BOOL)control:(NSControl*)control textShouldEndEditing:(NSText*)fieldEditor; | |
| 23 @end | |
| 24 | 14 |
| 25 namespace { | 15 namespace { |
| 26 | 16 |
| 27 // Width of the field so that we don't have to ask |field_| for it all | 17 // Width of the field so that we don't have to ask |field_| for it all |
| 28 // the time. | 18 // the time. |
| 29 static const CGFloat kWidth(300.0); | 19 static const CGFloat kWidth(300.0); |
| 30 | 20 |
| 31 class FindBarTextFieldTest : public CocoaTest { | 21 class FindBarTextFieldTest : public CocoaTest { |
| 32 public: | 22 public: |
| 33 FindBarTextFieldTest() { | 23 FindBarTextFieldTest() { |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 83 // Test display of various cell configurations. | 73 // Test display of various cell configurations. |
| 84 FindBarTextFieldCell* cell = [field_ findBarTextFieldCell]; | 74 FindBarTextFieldCell* cell = [field_ findBarTextFieldCell]; |
| 85 [cell setActiveMatch:4 of:5]; | 75 [cell setActiveMatch:4 of:5]; |
| 86 [field_ display]; | 76 [field_ display]; |
| 87 | 77 |
| 88 [cell clearResults]; | 78 [cell clearResults]; |
| 89 [field_ display]; | 79 [field_ display]; |
| 90 } | 80 } |
| 91 | 81 |
| 92 } // namespace | 82 } // namespace |
| OLD | NEW |