| OLD | NEW | 
|---|
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/autofill/autofill_pop_up_button.h" | 5 #import "chrome/browser/ui/cocoa/autofill/autofill_pop_up_button.h" | 
| 6 | 6 | 
| 7 #import "base/mac/scoped_nsobject.h" | 7 #import "base/mac/scoped_nsobject.h" | 
| 8 #include "base/macros.h" | 8 #include "base/macros.h" | 
| 9 #import "chrome/browser/ui/cocoa/cocoa_test_helper.h" | 9 #import "chrome/browser/ui/cocoa/test/cocoa_test_helper.h" | 
| 10 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" | 
| 11 #include "testing/platform_test.h" | 11 #include "testing/platform_test.h" | 
| 12 | 12 | 
| 13 class AutofillPopUpButtonTest : public CocoaTest { | 13 class AutofillPopUpButtonTest : public CocoaTest { | 
| 14  public: | 14  public: | 
| 15   AutofillPopUpButtonTest() { | 15   AutofillPopUpButtonTest() { | 
| 16     NSRect frame = NSMakeRect(0, 0, 50, 30); | 16     NSRect frame = NSMakeRect(0, 0, 50, 30); | 
| 17     button_.reset([[AutofillPopUpButton alloc] initWithFrame:frame]); | 17     button_.reset([[AutofillPopUpButton alloc] initWithFrame:frame]); | 
| 18     [button_ sizeToFit]; | 18     [button_ sizeToFit]; | 
| 19     [[test_window() contentView] addSubview:button_]; | 19     [[test_window() contentView] addSubview:button_]; | 
| 20   } | 20   } | 
| 21 | 21 | 
| 22  protected: | 22  protected: | 
| 23   base::scoped_nsobject<AutofillPopUpButton> button_; | 23   base::scoped_nsobject<AutofillPopUpButton> button_; | 
| 24 | 24 | 
| 25   DISALLOW_COPY_AND_ASSIGN(AutofillPopUpButtonTest); | 25   DISALLOW_COPY_AND_ASSIGN(AutofillPopUpButtonTest); | 
| 26 }; | 26 }; | 
| 27 | 27 | 
| 28 TEST_VIEW(AutofillPopUpButtonTest, button_) | 28 TEST_VIEW(AutofillPopUpButtonTest, button_) | 
| 29 | 29 | 
| 30 // Test invalid, mostly to ensure nothing leaks or crashes. | 30 // Test invalid, mostly to ensure nothing leaks or crashes. | 
| 31 TEST_F(AutofillPopUpButtonTest, DisplayWithInvalid) { | 31 TEST_F(AutofillPopUpButtonTest, DisplayWithInvalid) { | 
| 32   [button_ setValidityMessage:nil]; | 32   [button_ setValidityMessage:nil]; | 
| 33   [button_ display]; | 33   [button_ display]; | 
| 34   [button_ setValidityMessage:@"Something is rotten in the state of Denmark"]; | 34   [button_ setValidityMessage:@"Something is rotten in the state of Denmark"]; | 
| 35   [button_ display]; | 35   [button_ display]; | 
| 36 } | 36 } | 
| OLD | NEW | 
|---|