Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(152)

Side by Side Diff: chrome/browser/ui/cocoa/location_bar/autocomplete_text_field_cell_unittest.mm

Issue 2119033002: [Material][Mac] Implement Omnibox Verbose State Chips (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: nit Created 4 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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" 12 #import "chrome/browser/ui/cocoa/location_bar/verbose_state_bubble_decoration.h"
13 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h" 13 #import "chrome/browser/ui/cocoa/location_bar/keyword_hint_decoration.h"
14 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h" 14 #import "chrome/browser/ui/cocoa/location_bar/location_bar_decoration.h"
15 #import "chrome/browser/ui/cocoa/location_bar/location_icon_decoration.h" 15 #import "chrome/browser/ui/cocoa/location_bar/location_icon_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"
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after
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 VerboseStateBubbleDecoration verbose_bubble_decoration(
119 ev_bubble_decoration.SetVisible(true); 119 &location_icon_decoration, NULL);
Robert Sesek 2016/08/16 22:25:32 nullptr
spqchan 2016/08/17 00:41:18 Done.
120 ev_bubble_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]); 120 verbose_bubble_decoration.SetVisible(true);
121 ev_bubble_decoration.SetLabel(@"Application"); 121 verbose_bubble_decoration.SetImage([NSImage imageNamed:@"NSApplicationIcon"]);
122 [cell addLeftDecoration:&ev_bubble_decoration]; 122 verbose_bubble_decoration.SetLabel(@"Application");
123 EXPECT_NE(ev_bubble_decoration.GetWidthForSpace(kVeryWide), 123 [cell addLeftDecoration:&verbose_bubble_decoration];
124 EXPECT_NE(verbose_bubble_decoration.GetWidthForSpace(kVeryWide),
124 LocationBarDecoration::kOmittedWidth); 125 LocationBarDecoration::kOmittedWidth);
125 126
126 StarDecoration star_decoration(NULL); 127 StarDecoration star_decoration(NULL);
127 star_decoration.SetVisible(true); 128 star_decoration.SetVisible(true);
128 [cell addRightDecoration:&star_decoration]; 129 [cell addRightDecoration:&star_decoration];
129 EXPECT_NE(star_decoration.GetWidthForSpace(kVeryWide), 130 EXPECT_NE(star_decoration.GetWidthForSpace(kVeryWide),
130 LocationBarDecoration::kOmittedWidth); 131 LocationBarDecoration::kOmittedWidth);
131 132
132 KeywordHintDecoration keyword_hint_decoration; 133 KeywordHintDecoration keyword_hint_decoration;
133 keyword_hint_decoration.SetVisible(true); 134 keyword_hint_decoration.SetVisible(true);
(...skipping 159 matching lines...) Expand 10 before | Expand all | Expand 10 after
293 // |controlView| gets the tooltip for the left decoration. 294 // |controlView| gets the tooltip for the left decoration.
294 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; 295 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]];
295 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; 296 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect];
296 297
297 [cell updateToolTipsInRect:bounds ofView:controlView]; 298 [cell updateToolTipsInRect:bounds ofView:controlView];
298 299
299 EXPECT_OCMOCK_VERIFY(controlView); 300 EXPECT_OCMOCK_VERIFY(controlView);
300 } 301 }
301 302
302 } // namespace 303 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698