summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/infobar_gradient_view_unittest.mm
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 23:40:22 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-26 23:40:22 +0000
commit13d54f79c040c2e6beeed94e096d1fcf2b0f7101 (patch)
treee1f4ff9d2dc345dc8010b18d57b7120fa3464c7f /chrome/browser/cocoa/infobar_gradient_view_unittest.mm
parent3a14d29c7fbb32f44e84c0b5c25e8d618ed000a0 (diff)
downloadchromium_src-13d54f79c040c2e6beeed94e096d1fcf2b0f7101.zip
chromium_src-13d54f79c040c2e6beeed94e096d1fcf2b0f7101.tar.gz
chromium_src-13d54f79c040c2e6beeed94e096d1fcf2b0f7101.tar.bz2
First set of unittest fixes. Many more to come ;-)
TEST=run the unittests and watch them pass. BUG=none Review URL: http://codereview.chromium.org/334016 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@30126 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/infobar_gradient_view_unittest.mm')
-rw-r--r--chrome/browser/cocoa/infobar_gradient_view_unittest.mm28
1 files changed, 7 insertions, 21 deletions
diff --git a/chrome/browser/cocoa/infobar_gradient_view_unittest.mm b/chrome/browser/cocoa/infobar_gradient_view_unittest.mm
index fafa206..2c1ec21 100644
--- a/chrome/browser/cocoa/infobar_gradient_view_unittest.mm
+++ b/chrome/browser/cocoa/infobar_gradient_view_unittest.mm
@@ -2,40 +2,26 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#import <Cocoa/Cocoa.h>
-
#include "base/scoped_nsobject.h"
#import "chrome/browser/cocoa/infobar_gradient_view.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
namespace {
-class InfoBarGradientViewTest : public PlatformTest {
+class InfoBarGradientViewTest : public CocoaTest {
public:
InfoBarGradientViewTest() {
NSRect frame = NSMakeRect(0, 0, 100, 30);
- view_.reset([[InfoBarGradientView alloc] initWithFrame:frame]);
- [cocoa_helper_.contentView() addSubview:view_.get()];
+ scoped_nsobject<InfoBarGradientView> view(
+ [[InfoBarGradientView alloc] initWithFrame:frame]);
+ view_ = view.get();
+ [[test_window() contentView] addSubview:view_];
}
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
- scoped_nsobject<InfoBarGradientView> view_;
+ InfoBarGradientView* view_; // Weak. Retained by view hierarchy.
};
-// Test adding/removing from the view hierarchy, mostly to ensure nothing
-// leaks or crashes.
-TEST_F(InfoBarGradientViewTest, AddRemove) {
- EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]);
- [view_.get() removeFromSuperview];
- EXPECT_FALSE([view_ superview]);
-}
-
-// Test drawing, mostly to ensure nothing leaks or crashes.
-TEST_F(InfoBarGradientViewTest, Display) {
- [view_ display];
-}
+TEST_VIEW(InfoBarGradientViewTest, view_);
// Assert that the view is non-opaque, because otherwise we will end
// up with findbar painting issues.