summaryrefslogtreecommitdiffstats
path: root/chrome/browser/cocoa/sad_tab_view_unittest.mm
diff options
context:
space:
mode:
authordmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 19:41:04 +0000
committerdmaclach@chromium.org <dmaclach@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2009-10-23 19:41:04 +0000
commitc743b0591ddaa6b2d550be938153c273853e167e (patch)
tree7aec146b0deef8ef7899d1c12237f7809cc0c731 /chrome/browser/cocoa/sad_tab_view_unittest.mm
parent72512a9af1270285600905f0084cd0cd730688b2 (diff)
downloadchromium_src-c743b0591ddaa6b2d550be938153c273853e167e.zip
chromium_src-c743b0591ddaa6b2d550be938153c273853e167e.tar.gz
chromium_src-c743b0591ddaa6b2d550be938153c273853e167e.tar.bz2
Basic test class that is going to replace CocoaTestHelper and CocoaNoWindowTestHelper.
Is responsible for bootstrapping cocoa and verifying that all windows are closed down correctly between tests. Also includes a macro for doing some very repetitive view testing that we had multiple copies of. I included a single changed over test so that you can see the difference. BUG=none TEST=none Review URL: http://codereview.chromium.org/327010 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@29928 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/cocoa/sad_tab_view_unittest.mm')
-rw-r--r--chrome/browser/cocoa/sad_tab_view_unittest.mm31
1 files changed, 8 insertions, 23 deletions
diff --git a/chrome/browser/cocoa/sad_tab_view_unittest.mm b/chrome/browser/cocoa/sad_tab_view_unittest.mm
index 49c24e3..382fdb6 100644
--- a/chrome/browser/cocoa/sad_tab_view_unittest.mm
+++ b/chrome/browser/cocoa/sad_tab_view_unittest.mm
@@ -2,39 +2,24 @@
// 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/sad_tab_view.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
namespace {
-class SadTabViewTest : public PlatformTest {
+class SadTabViewTest : public CocoaTest {
public:
SadTabViewTest() {
- NSRect content_frame = [cocoa_helper_.contentView() frame];
- view_.reset([[SadTabView alloc] initWithFrame:content_frame]);
- [cocoa_helper_.contentView() addSubview:view_.get()];
+ NSRect content_frame = [[test_window() contentView] frame];
+ scoped_nsobject<SadTabView> view([[SadTabView alloc]
+ initWithFrame:content_frame]);
+ view_ = view.get();
+ [[test_window() contentView] addSubview:view_];
}
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
- scoped_nsobject<SadTabView> view_;
+ SadTabView* view_; // Weak. Owned by the view hierarchy.
};
-// Test adding/removing from the view hierarchy, mostly to ensure nothing
-// leaks or crashes.
-TEST_F(SadTabViewTest, 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(SadTabViewTest, Display) {
- [view_ display];
-}
+TEST_VIEW(SadTabViewTest, view_)
} // namespace