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

Unified Diff: chrome/browser/cocoa/location_bar_view_mac_unittest.mm

Issue 402066: Moved a whole pile of unittests over to CocoaTest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 1 month 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/cocoa/location_bar_view_mac_unittest.mm
===================================================================
--- chrome/browser/cocoa/location_bar_view_mac_unittest.mm (revision 32421)
+++ chrome/browser/cocoa/location_bar_view_mac_unittest.mm (working copy)
@@ -59,20 +59,21 @@
namespace {
-class LocationBarViewMacTest : public PlatformTest {
+class LocationBarViewMacTest : public CocoaTest {
public:
LocationBarViewMacTest() {
// Make sure this is wide enough to play games with the cell
// decorations.
NSRect frame = NSMakeRect(0, 0, 400.0, 30);
- field_.reset([[AutocompleteTextField alloc] initWithFrame:frame]);
+ scoped_nsobject<AutocompleteTextField> field(
+ [[AutocompleteTextField alloc] initWithFrame:frame]);
+ field_ = field.get();
[field_ setStringValue:@"Testing"];
- [cocoa_helper_.contentView() addSubview:field_.get()];
+ [[test_window() contentView] addSubview:field_];
}
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
BrowserTestHelper helper_;
- scoped_nsobject<AutocompleteTextField> field_;
+ AutocompleteTextField* field_;
};
TEST_F(LocationBarViewMacTest, OnChangedImpl) {
@@ -90,25 +91,25 @@
// With no special hints requested, none set.
LocationBarViewMac::OnChangedImpl(
- field_.get(), std::wstring(), std::wstring(), false, false, image);
+ field_, std::wstring(), std::wstring(), false, false, image);
EXPECT_FALSE([cell keywordString]);
EXPECT_FALSE([cell hintString]);
// Request only a search hint.
LocationBarViewMac::OnChangedImpl(
- field_.get(), std::wstring(), std::wstring(), false, true, image);
+ field_, std::wstring(), std::wstring(), false, true, image);
EXPECT_FALSE([cell keywordString]);
EXPECT_TRUE([[[cell hintString] string] isEqualToString:kSearchHint]);
// Request a keyword hint, same results whether |search_hint|
// parameter is true or false.
LocationBarViewMac::OnChangedImpl(
- field_.get(), kKeyword, kKeyword, true, true, image);
+ field_, kKeyword, kKeyword, true, true, image);
EXPECT_FALSE([cell keywordString]);
EXPECT_TRUE([[[cell hintString] string] hasPrefix:kKeywordPrefix]);
EXPECT_TRUE([[[cell hintString] string] hasSuffix:kKeywordSuffix]);
LocationBarViewMac::OnChangedImpl(
- field_.get(), kKeyword, kKeyword, true, false, image);
+ field_, kKeyword, kKeyword, true, false, image);
EXPECT_FALSE([cell keywordString]);
EXPECT_TRUE([[[cell hintString] string] hasPrefix:kKeywordPrefix]);
EXPECT_TRUE([[[cell hintString] string] hasSuffix:kKeywordSuffix]);
@@ -116,11 +117,11 @@
// Request keyword-search mode, same results whether |search_hint|
// parameter is true or false.
LocationBarViewMac::OnChangedImpl(
- field_.get(), kKeyword, kKeyword, false, true, image);
+ field_, kKeyword, kKeyword, false, true, image);
EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kKeywordString]);
EXPECT_FALSE([cell hintString]);
LocationBarViewMac::OnChangedImpl(
- field_.get(), kKeyword, kKeyword, false, false, image);
+ field_, kKeyword, kKeyword, false, false, image);
EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kKeywordString]);
EXPECT_FALSE([cell hintString]);
@@ -132,13 +133,13 @@
frame.size.width = 10.0;
[field_ setFrame:frame];
LocationBarViewMac::OnChangedImpl(
- field_.get(), kKeyword, kKeyword, false, true, image);
+ field_, kKeyword, kKeyword, false, true, image);
EXPECT_TRUE([[[cell keywordString] string] isEqualToString:kPartialString]);
EXPECT_FALSE([cell hintString]);
// Transition back to baseline.
LocationBarViewMac::OnChangedImpl(
- field_.get(), std::wstring(), std::wstring(), false, false, image);
+ field_, std::wstring(), std::wstring(), false, false, image);
EXPECT_FALSE([cell keywordString]);
EXPECT_FALSE([cell hintString]);
}

Powered by Google App Engine
This is Rietveld 408576698