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

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

Issue 2375033002: cocoa browser: remove non-MD location bar support (Closed)
Patch Set: Created 4 years, 2 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"
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after
158 NSRect textFrame; 158 NSRect textFrame;
159 159
160 // The cursor frame should stay the same throughout. 160 // The cursor frame should stay the same throughout.
161 const NSRect cursorFrame([cell textCursorFrameForFrame:bounds]); 161 const NSRect cursorFrame([cell textCursorFrameForFrame:bounds]);
162 EXPECT_NSEQ(cursorFrame, bounds); 162 EXPECT_NSEQ(cursorFrame, bounds);
163 163
164 // At default settings, everything goes to the text area. 164 // At default settings, everything goes to the text area.
165 textFrame = [cell textFrameForFrame:bounds]; 165 textFrame = [cell textFrameForFrame:bounds];
166 EXPECT_FALSE(NSIsEmptyRect(textFrame)); 166 EXPECT_FALSE(NSIsEmptyRect(textFrame));
167 EXPECT_TRUE(NSContainsRect(bounds, textFrame)); 167 EXPECT_TRUE(NSContainsRect(bounds, textFrame));
168 if (ui::MaterialDesignController::IsModeMaterial()) { 168 EXPECT_EQ(1, NSMinX(textFrame));
169 EXPECT_EQ(1, NSMinX(textFrame));
170 } else {
171 EXPECT_EQ(NSMinX(bounds), NSMinX(textFrame));
172 }
173 EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame)); 169 EXPECT_EQ(NSMaxX(bounds), NSMaxX(textFrame));
174 EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame)); 170 EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
175 171
176 // Decoration on the left takes up space. 172 // Decoration on the left takes up space.
177 mock_left_decoration_.SetVisible(true); 173 mock_left_decoration_.SetVisible(true);
178 textFrame = [cell textFrameForFrame:bounds]; 174 textFrame = [cell textFrameForFrame:bounds];
179 EXPECT_FALSE(NSIsEmptyRect(textFrame)); 175 EXPECT_FALSE(NSIsEmptyRect(textFrame));
180 EXPECT_TRUE(NSContainsRect(bounds, textFrame)); 176 EXPECT_TRUE(NSContainsRect(bounds, textFrame));
181 EXPECT_GT(NSMinX(textFrame), NSMinX(bounds)); 177 EXPECT_GT(NSMinX(textFrame), NSMinX(bounds));
182 EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame)); 178 EXPECT_TRUE(NSContainsRect(cursorFrame, textFrame));
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after
295 // |controlView| gets the tooltip for the left decoration. 291 // |controlView| gets the tooltip for the left decoration.
296 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]]; 292 id controlView = [OCMockObject mockForClass:[AutocompleteTextField class]];
297 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect]; 293 [[controlView expect] addToolTip:tooltip forRect:leftDecorationRect];
298 294
299 [cell updateToolTipsInRect:bounds ofView:controlView]; 295 [cell updateToolTipsInRect:bounds ofView:controlView];
300 296
301 EXPECT_OCMOCK_VERIFY(controlView); 297 EXPECT_OCMOCK_VERIFY(controlView);
302 } 298 }
303 299
304 } // namespace 300 } // namespace
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698