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" |
11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell.h" |
12 #import "chrome/browser/ui/cocoa/location_bar/ev_bubble_decoration.h" | |
13 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" | 12 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" |
14 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" | 13 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" |
15 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" | 14 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" |
| 15 #import "chrome/browser/ui/cocoa/location_bar/security_state_bubble_decoration.h
" |
16 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" | 16 #import "chrome/browser/ui/cocoa/location_bar/selected_keyword_decoration.h" |
17 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" | 17 #import "chrome/browser/ui/cocoa/location_bar/star_decoration.h" |
18 #include "testing/gmock/include/gmock/gmock.h" | 18 #include "testing/gmock/include/gmock/gmock.h" |
19 #include "testing/gtest/include/gtest/gtest.h" | 19 #include "testing/gtest/include/gtest/gtest.h" |
20 #import "testing/gtest_mac.h" | 20 #import "testing/gtest_mac.h" |
21 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
22 #import "third_party/ocmock/OCMock/OCMock.h" | 22 #import "third_party/ocmock/OCMock/OCMock.h" |
23 #include "third_party/ocmock/gtest_support.h" | 23 #include "third_party/ocmock/gtest_support.h" |
24 #include "ui/base/material_design/material_design_controller.h" | 24 #include "ui/base/material_design/material_design_controller.h" |
25 | 25 |
(...skipping 82 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
108 // TODO(shess): This really wants a |LocationBarViewMac|, but only a | 108 // TODO(shess): This really wants a |LocationBarViewMac|, but only a |
109 // few methods reference it, so this works well enough. But | 109 // few methods reference it, so this works well enough. But |
110 // something better would be nice. | 110 // something better would be nice. |
111 LocationIconDecoration location_icon_decoration(NULL); | 111 LocationIconDecoration location_icon_decoration(NULL); |
112 location_icon_decoration.SetVisible(true); | 112 location_icon_decoration.SetVisible(true); |
113 location_icon_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); | 113 location_icon_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); |
114 [cell addLeftDecoration:&location_icon_decoration]; | 114 [cell addLeftDecoration:&location_icon_decoration]; |
115 EXPECT_NE(location_icon_decoration.GetWidthForSpace(kVeryWide), | 115 EXPECT_NE(location_icon_decoration.GetWidthForSpace(kVeryWide), |
116 LocationBarDecoration::kOmittedWidth); | 116 LocationBarDecoration::kOmittedWidth); |
117 | 117 |
118 EVBubbleDecoration ev_bubble_decoration(&location_icon_decoration); | 118 SecurityStateBubbleDecoration security_state_bubble_decoration( |
119 ev_bubble_decoration.SetVisible(true); | 119 &location_icon_decoration, nullptr); |
120 ev_bubble_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); | 120 security_state_bubble_decoration.SetVisible(true); |
121 ev_bubble_decoration.SetLabel(@"Application"); | 121 security_state_bubble_decoration.SetImage( |
122 [cell addLeftDecoration:&ev_bubble_decoration]; | 122 [NSImage imageNamed:@"NSApplicationIcon"]); |
123 EXPECT_NE(ev_bubble_decoration.GetWidthForSpace(kVeryWide), | 123 security_state_bubble_decoration.SetLabel(@"Application"); |
| 124 [cell addLeftDecoration:&security_state_bubble_decoration]; |
| 125 EXPECT_NE(security_state_bubble_decoration.GetWidthForSpace(kVeryWide), |
124 LocationBarDecoration::kOmittedWidth); | 126 LocationBarDecoration::kOmittedWidth); |
125 | 127 |
126 StarDecoration star_decoration(NULL); | 128 StarDecoration star_decoration(NULL); |
127 star_decoration.SetVisible(true); | 129 star_decoration.SetVisible(true); |
128 [cell addRightDecoration:&star_decoration]; | 130 [cell addRightDecoration:&star_decoration]; |
129 EXPECT_NE(star_decoration.GetWidthForSpace(kVeryWide), | 131 EXPECT_NE(star_decoration.GetWidthForSpace(kVeryWide), |
130 LocationBarDecoration::kOmittedWidth); | 132 LocationBarDecoration::kOmittedWidth); |
131 | 133 |
132 KeywordHintDecoration keyword_hint_decoration; | 134 KeywordHintDecoration keyword_hint_decoration; |
133 keyword_hint_decoration.SetVisible(true); | 135 keyword_hint_decoration.SetVisible(true); |
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
293 // |controlView| gets the tooltip for the left decoration. | 295 // |controlView| gets the tooltip for the left decoration. |
294 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; | 296 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; |
295 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; | 297 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; |
296 | 298 |
297 [cell updateToolTipsInRect:bounds ofView:controlView]; | 299 [cell updateToolTipsInRect:bounds ofView:controlView]; |
298 | 300 |
299 EXPECT_OCMOCK_VERIFY(controlView); | 301 EXPECT_OCMOCK_VERIFY(controlView); |
300 } | 302 } |
301 | 303 |
302 } // namespace | 304 } // namespace |
OLD | NEW |