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

Side by Side Diff: chrome/browser/cocoa/location_bar_view_mac_unittest.mm

Issue 1581011: [Mac] Magnifying glass in keyword-search bubble. (Closed)
Patch Set: Present for Rohit. Created 10 years, 8 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
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "base/scoped_nsobject.h" 5 #include "base/scoped_nsobject.h"
6 #include "base/scoped_ptr.h" 6 #include "base/scoped_ptr.h"
7 #include "base/string_util.h" 7 #include "base/string_util.h"
8 #include "chrome/browser/cocoa/autocomplete_text_field.h" 8 #include "chrome/browser/cocoa/autocomplete_text_field.h"
9 #include "chrome/browser/cocoa/autocomplete_text_field_cell.h" 9 #include "chrome/browser/cocoa/autocomplete_text_field_cell.h"
10 #include "chrome/browser/cocoa/browser_test_helper.h" 10 #include "chrome/browser/cocoa/browser_test_helper.h"
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after
111 LocationBarViewMac::OnChangedImpl( 111 LocationBarViewMac::OnChangedImpl(
112 field_, kKeyword, kKeyword, true, false, image); 112 field_, kKeyword, kKeyword, true, false, image);
113 EXPECT_FALSE([cell keywordString]); 113 EXPECT_FALSE([cell keywordString]);
114 EXPECT_TRUE([[[cell hintString] string] hasPrefix:kKeywordPrefix]); 114 EXPECT_TRUE([[[cell hintString] string] hasPrefix:kKeywordPrefix]);
115 EXPECT_TRUE([[[cell hintString] string] hasSuffix:kKeywordSuffix]); 115 EXPECT_TRUE([[[cell hintString] string] hasSuffix:kKeywordSuffix]);
116 116
117 // Request keyword-search mode, same results whether |search_hint| 117 // Request keyword-search mode, same results whether |search_hint|
118 // parameter is true or false. 118 // parameter is true or false.
119 LocationBarViewMac::OnChangedImpl( 119 LocationBarViewMac::OnChangedImpl(
120 field_, kKeyword, kKeyword, false, true, image); 120 field_, kKeyword, kKeyword, false, true, image);
121 EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kKeywordString]); 121 EXPECT_TRUE([[[cell keywordString] string] hasSuffix:kKeywordString]);
122 EXPECT_FALSE([cell hintString]); 122 EXPECT_FALSE([cell hintString]);
123 LocationBarViewMac::OnChangedImpl( 123 LocationBarViewMac::OnChangedImpl(
124 field_, kKeyword, kKeyword, false, false, image); 124 field_, kKeyword, kKeyword, false, false, image);
125 EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kKeywordString]); 125 EXPECT_TRUE([[[cell keywordString] string] hasSuffix:kKeywordString]);
126 EXPECT_FALSE([cell hintString]); 126 EXPECT_FALSE([cell hintString]);
127 127
128 // Check that a partial keyword-search string is passed down in case 128 // Check that a partial keyword-search string is passed down in case
129 // the view is narrow. 129 // the view is narrow.
130 // TODO(shess): Is this test a good argument for re-writing using a 130 // TODO(shess): Is this test a good argument for re-writing using a
131 // mock field? 131 // mock field?
132 NSRect frame([field_ frame]); 132 NSRect frame([field_ frame]);
133 frame.size.width = 10.0; 133 frame.size.width = 10.0;
134 [field_ setFrame:frame]; 134 [field_ setFrame:frame];
135 LocationBarViewMac::OnChangedImpl( 135 LocationBarViewMac::OnChangedImpl(
136 field_, kKeyword, kKeyword, false, true, image); 136 field_, kKeyword, kKeyword, false, true, image);
137 EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kPartialString]); 137 EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kPartialString]);
138 EXPECT_FALSE([cell hintString]); 138 EXPECT_FALSE([cell hintString]);
139 139
140 // Transition back to baseline. 140 // Transition back to baseline.
141 LocationBarViewMac::OnChangedImpl( 141 LocationBarViewMac::OnChangedImpl(
142 field_, std::wstring(), std::wstring(), false, false, image); 142 field_, std::wstring(), std::wstring(), false, false, image);
143 EXPECT_FALSE([cell keywordString]); 143 EXPECT_FALSE([cell keywordString]);
144 EXPECT_FALSE([cell hintString]); 144 EXPECT_FALSE([cell hintString]);
145 } 145 }
146 146
147 } // namespace 147 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/cocoa/autocomplete_text_field_cell_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698