OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 | 74 |
75 BrowserTestHelper helper_; | 75 BrowserTestHelper helper_; |
76 AutocompleteTextField* field_; | 76 AutocompleteTextField* field_; |
77 }; | 77 }; |
78 | 78 |
79 TEST_F(LocationBarViewMacTest, OnChangedImpl) { | 79 TEST_F(LocationBarViewMacTest, OnChangedImpl) { |
80 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; | 80 AutocompleteTextFieldCell* cell = [field_ autocompleteTextFieldCell]; |
81 NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"]; | 81 NSImage* image = [NSImage imageNamed:@"NSApplicationIcon"]; |
82 | 82 |
83 const std::wstring kKeyword(L"Google"); | 83 const std::wstring kKeyword(L"Google"); |
84 const NSString* kKeywordPrefix = @"Press "; | 84 NSString* const kKeywordPrefix = @"Press "; |
85 const NSString* kKeywordSuffix = @" to search Google"; | 85 NSString* const kKeywordSuffix = @" to search Google"; |
86 const NSString* kKeywordString = @"Search Google:"; | 86 NSString* const kKeywordString = @"Search Google:"; |
87 // 0x2026 is Unicode ellipses. | 87 // 0x2026 is Unicode ellipses. |
88 const NSString* kPartialString = | 88 NSString* const kPartialString = |
89 [NSString stringWithFormat:@"Search Go%C:", 0x2026]; | 89 [NSString stringWithFormat:@"Search Go%C:", 0x2026]; |
90 | 90 |
91 // With no special hints requested, none set. | 91 // With no special hints requested, none set. |
92 LocationBarViewMac::OnChangedImpl(field_, std::wstring(), std::wstring(), | 92 LocationBarViewMac::OnChangedImpl(field_, std::wstring(), std::wstring(), |
93 false, false, image); | 93 false, false, image); |
94 EXPECT_FALSE([cell keywordString]); | 94 EXPECT_FALSE([cell keywordString]); |
95 EXPECT_FALSE([cell hintString]); | 95 EXPECT_FALSE([cell hintString]); |
96 | 96 |
97 // Request a keyword hint. | 97 // Request a keyword hint. |
98 LocationBarViewMac::OnChangedImpl(field_, kKeyword, kKeyword, | 98 LocationBarViewMac::OnChangedImpl(field_, kKeyword, kKeyword, |
(...skipping 21 matching lines...) Expand all Loading... |
120 EXPECT_FALSE([cell hintString]); | 120 EXPECT_FALSE([cell hintString]); |
121 | 121 |
122 // Transition back to baseline. | 122 // Transition back to baseline. |
123 LocationBarViewMac::OnChangedImpl( | 123 LocationBarViewMac::OnChangedImpl( |
124 field_, std::wstring(), std::wstring(), false, false, image); | 124 field_, std::wstring(), std::wstring(), false, false, image); |
125 EXPECT_FALSE([cell keywordString]); | 125 EXPECT_FALSE([cell keywordString]); |
126 EXPECT_FALSE([cell hintString]); | 126 EXPECT_FALSE([cell hintString]); |
127 } | 127 } |
128 | 128 |
129 } // namespace | 129 } // namespace |
OLD | NEW |