OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_view_mac.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/macros.h" | 9 #include "base/macros.h" |
10 #include "base/memory/ptr_util.h" | 10 #include "base/memory/ptr_util.h" |
(...skipping 193 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
204 atIndex:0 | 204 atIndex:0 |
205 effectiveRange:NULL]; | 205 effectiveRange:NULL]; |
206 DCHECK(paragraphStyle); | 206 DCHECK(paragraphStyle); |
207 EXPECT_EQ(paragraphStyle.alignment, NSLeftTextAlignment); | 207 EXPECT_EQ(paragraphStyle.alignment, NSLeftTextAlignment); |
208 EXPECT_EQ(paragraphStyle.baseWritingDirection, NSWritingDirectionLeftToRight); | 208 EXPECT_EQ(paragraphStyle.baseWritingDirection, NSWritingDirectionLeftToRight); |
209 } | 209 } |
210 | 210 |
211 TEST_F(OmniboxViewMacTest, WritingDirectionRTL) { | 211 TEST_F(OmniboxViewMacTest, WritingDirectionRTL) { |
212 cocoa_l10n_util::ScopedForceRTLMac rtl; | 212 cocoa_l10n_util::ScopedForceRTLMac rtl; |
213 | 213 |
| 214 LOG(ERROR) << "1"; |
214 TestingToolbarModelDelegate delegate; | 215 TestingToolbarModelDelegate delegate; |
| 216 LOG(ERROR) << "1.1"; |
215 ToolbarModelImpl toolbar_model(&delegate, 32 * 1024); | 217 ToolbarModelImpl toolbar_model(&delegate, 32 * 1024); |
| 218 LOG(ERROR) << "2"; |
216 TestingOmniboxEditController edit_controller(&toolbar_model); | 219 TestingOmniboxEditController edit_controller(&toolbar_model); |
| 220 LOG(ERROR) << "2.1"; |
217 OmniboxViewMac view(&edit_controller, profile(), NULL, NULL); | 221 OmniboxViewMac view(&edit_controller, profile(), NULL, NULL); |
| 222 LOG(ERROR) << "3"; |
218 | 223 |
219 // This is deleted by the omnibox view. | 224 // This is deleted by the omnibox view. |
220 MockOmniboxEditModel* model = | 225 MockOmniboxEditModel* model = |
221 new MockOmniboxEditModel(&view, &edit_controller, profile()); | 226 new MockOmniboxEditModel(&view, &edit_controller, profile()); |
| 227 LOG(ERROR) << "3.1"; |
222 MockOmniboxPopupView popup_view; | 228 MockOmniboxPopupView popup_view; |
| 229 LOG(ERROR) << "3.2"; |
223 OmniboxPopupModel popup_model(&popup_view, model); | 230 OmniboxPopupModel popup_model(&popup_view, model); |
| 231 LOG(ERROR) << "3.3"; |
224 | 232 |
225 model->OnSetFocus(true); | 233 model->OnSetFocus(true); |
| 234 LOG(ERROR) << "4"; |
226 SetModel(&view, model); | 235 SetModel(&view, model); |
| 236 LOG(ERROR) << "4.1"; |
227 view.SetUserText(base::ASCIIToUTF16("foo.com")); | 237 view.SetUserText(base::ASCIIToUTF16("foo.com")); |
| 238 LOG(ERROR) << "4.2"; |
228 model->OnChanged(); | 239 model->OnChanged(); |
| 240 LOG(ERROR) << "4.3"; |
229 | 241 |
230 base::scoped_nsobject<NSMutableAttributedString> string( | 242 base::scoped_nsobject<NSMutableAttributedString> string( |
231 [[NSMutableAttributedString alloc] initWithString:@"foo.com"]); | 243 [[NSMutableAttributedString alloc] initWithString:@"foo.com"]); |
| 244 LOG(ERROR) << "4.4"; |
232 view.ApplyTextStyle(string); | 245 view.ApplyTextStyle(string); |
| 246 LOG(ERROR) << "4.5"; |
233 | 247 |
234 NSParagraphStyle* paragraphStyle = | 248 NSParagraphStyle* paragraphStyle = |
235 [string attribute:NSParagraphStyleAttributeName | 249 [string attribute:NSParagraphStyleAttributeName |
236 atIndex:0 | 250 atIndex:0 |
237 effectiveRange:NULL]; | 251 effectiveRange:NULL]; |
| 252 LOG(ERROR) << "5"; |
238 DCHECK(paragraphStyle); | 253 DCHECK(paragraphStyle); |
| 254 LOG(ERROR) << "5.1"; |
239 EXPECT_EQ(paragraphStyle.alignment, NSRightTextAlignment); | 255 EXPECT_EQ(paragraphStyle.alignment, NSRightTextAlignment); |
| 256 LOG(ERROR) << "5.2"; |
240 EXPECT_EQ(paragraphStyle.baseWritingDirection, NSWritingDirectionLeftToRight); | 257 EXPECT_EQ(paragraphStyle.baseWritingDirection, NSWritingDirectionLeftToRight); |
| 258 LOG(ERROR) << "5.3"; |
241 } | 259 } |
OLD | NEW |