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_popup_view_mac.h" | 5 #import "chrome/browser/ui/cocoa/omnibox/omnibox_popup_view_mac.h" |
6 | 6 |
7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "testing/platform_test.h" | 10 #include "testing/platform_test.h" |
(...skipping 431 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
442 TEST_F(OmniboxPopupViewMacTest, ElideString) { | 442 TEST_F(OmniboxPopupViewMacTest, ElideString) { |
443 NSString* const contents = @"This is a test with long contents"; | 443 NSString* const contents = @"This is a test with long contents"; |
444 const string16 contents16(base::SysNSStringToUTF16(contents)); | 444 const string16 contents16(base::SysNSStringToUTF16(contents)); |
445 | 445 |
446 const float kWide = 1000.0; | 446 const float kWide = 1000.0; |
447 const float kNarrow = 20.0; | 447 const float kNarrow = 20.0; |
448 | 448 |
449 NSDictionary* attributes = | 449 NSDictionary* attributes = |
450 [NSDictionary dictionaryWithObject:font_.GetNativeFont() | 450 [NSDictionary dictionaryWithObject:font_.GetNativeFont() |
451 forKey:NSFontAttributeName]; | 451 forKey:NSFontAttributeName]; |
452 scoped_nsobject<NSMutableAttributedString> as( | 452 base::scoped_nsobject<NSMutableAttributedString> as( |
453 [[NSMutableAttributedString alloc] initWithString:contents | 453 [[NSMutableAttributedString alloc] initWithString:contents |
454 attributes:attributes]); | 454 attributes:attributes]); |
455 | 455 |
456 // Nothing happens if the space is really wide. | 456 // Nothing happens if the space is really wide. |
457 NSMutableAttributedString* ret = | 457 NSMutableAttributedString* ret = |
458 OmniboxPopupViewMac::ElideString(as, contents16, font_, kWide); | 458 OmniboxPopupViewMac::ElideString(as, contents16, font_, kWide); |
459 EXPECT_TRUE(ret == as); | 459 EXPECT_TRUE(ret == as); |
460 EXPECT_TRUE([[as string] isEqualToString:contents]); | 460 EXPECT_TRUE([[as string] isEqualToString:contents]); |
461 | 461 |
462 // When elided, result is the same as ElideText(). | 462 // When elided, result is the same as ElideText(). |
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
543 // updates the model's selection from the matrix before returning. | 543 // updates the model's selection from the matrix before returning. |
544 // Could possibly test that via -select:. | 544 // Could possibly test that via -select:. |
545 | 545 |
546 // TODO(shess): Test that AutocompleteButtonCell returns the right | 546 // TODO(shess): Test that AutocompleteButtonCell returns the right |
547 // background colors for on, highlighted, and neither. | 547 // background colors for on, highlighted, and neither. |
548 | 548 |
549 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized | 549 // TODO(shess): Test that AutocompleteMatrixTarget can be initialized |
550 // and then sends -select: to the view. | 550 // and then sends -select: to the view. |
551 | 551 |
552 } // namespace | 552 } // namespace |
OLD | NEW |