| 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 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" |
| 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" | 10 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field.h" |
| (...skipping 15 matching lines...) Expand all Loading... |
| 26 using ::testing::Return; | 26 using ::testing::Return; |
| 27 using ::testing::StrictMock; | 27 using ::testing::StrictMock; |
| 28 using ::testing::_; | 28 using ::testing::_; |
| 29 | 29 |
| 30 namespace { | 30 namespace { |
| 31 | 31 |
| 32 // Width of the field so that we don't have to ask |field_| for it all | 32 // Width of the field so that we don't have to ask |field_| for it all |
| 33 // the time. | 33 // the time. |
| 34 const CGFloat kWidth(300.0); | 34 const CGFloat kWidth(300.0); |
| 35 | 35 |
| 36 // A narrow width for tests which test things that don't fit. | |
| 37 const CGFloat kNarrowWidth(5.0); | |
| 38 | |
| 39 class MockDecoration : public LocationBarDecoration { | 36 class MockDecoration : public LocationBarDecoration { |
| 40 public: | 37 public: |
| 41 virtual CGFloat GetWidthForSpace(CGFloat width) { return 20.0; } | 38 virtual CGFloat GetWidthForSpace(CGFloat width) { return 20.0; } |
| 42 | 39 |
| 43 MOCK_METHOD2(DrawInFrame, void(NSRect frame, NSView* control_view)); | 40 MOCK_METHOD2(DrawInFrame, void(NSRect frame, NSView* control_view)); |
| 44 MOCK_METHOD0(GetToolTip, NSString*()); | 41 MOCK_METHOD0(GetToolTip, NSString*()); |
| 45 }; | 42 }; |
| 46 | 43 |
| 47 class AutocompleteTextFieldCellTest : public CocoaTest { | 44 class AutocompleteTextFieldCellTest : public CocoaTest { |
| 48 public: | 45 public: |
| (...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 292 // |controlView| gets the tooltip for the left decoration. | 289 // |controlView| gets the tooltip for the left decoration. |
| 293 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; | 290 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; |
| 294 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; | 291 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; |
| 295 | 292 |
| 296 [cell updateToolTipsInRect:bounds ofView:controlView]; | 293 [cell updateToolTipsInRect:bounds ofView:controlView]; |
| 297 | 294 |
| 298 EXPECT_OCMOCK_VERIFY(controlView); | 295 EXPECT_OCMOCK_VERIFY(controlView); |
| 299 } | 296 } |
| 300 | 297 |
| 301 } // namespace | 298 } // namespace |
| OLD | NEW |