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

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

Issue 334016: First set of unittest fixes. Many more to come ;-)... (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: '' Created 11 years, 2 months 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
« no previous file with comments | « chrome/browser/cocoa/infobar_gradient_view_unittest.mm ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/cocoa/menu_button_unittest.mm
===================================================================
--- chrome/browser/cocoa/menu_button_unittest.mm (revision 29973)
+++ chrome/browser/cocoa/menu_button_unittest.mm (working copy)
@@ -2,45 +2,31 @@
// 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/clickhold_button_cell.h"
#import "chrome/browser/cocoa/cocoa_test_helper.h"
#import "chrome/browser/cocoa/menu_button.h"
-#include "testing/gtest/include/gtest/gtest.h"
-#include "testing/platform_test.h"
namespace {
-class MenuButtonTest : public PlatformTest {
+class MenuButtonTest : public CocoaTest {
public:
MenuButtonTest() {
NSRect frame = NSMakeRect(0, 0, 50, 30);
- button_.reset([[MenuButton alloc] initWithFrame:frame]);
+ scoped_nsobject<MenuButton> button(
+ [[MenuButton alloc] initWithFrame:frame]);
+ button_ = button.get();
scoped_nsobject<ClickHoldButtonCell> cell(
[[ClickHoldButtonCell alloc] initTextCell:@"Testing"]);
[button_ setCell:cell.get()];
- [cocoa_helper_.contentView() addSubview:button_.get()];
+ [[test_window() contentView] addSubview:button_];
}
- scoped_nsobject<MenuButton> button_;
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc.
+ MenuButton* button_;
};
-// Test adding/removing from the view hierarchy, mostly to ensure nothing leaks
-// or crashes.
-TEST_F(MenuButtonTest, AddRemove) {
- EXPECT_EQ(cocoa_helper_.contentView(), [button_ superview]);
- [button_.get() removeFromSuperview];
- EXPECT_FALSE([button_ superview]);
-}
+TEST_VIEW(MenuButtonTest, button_)
-// Test drawing, mostly to ensure nothing leaks or crashes.
-TEST_F(MenuButtonTest, Display) {
- [button_ display];
-}
-
// Test assigning a menu, again mostly to ensure nothing leaks or crashes.
TEST_F(MenuButtonTest, MenuAssign) {
scoped_nsobject<NSMenu> menu([[NSMenu alloc] initWithTitle:@""]);
@@ -50,7 +36,7 @@
[menu insertItemWithTitle:@"foo" action:nil keyEquivalent:@"" atIndex:1];
[menu insertItemWithTitle:@"bar" action:nil keyEquivalent:@"" atIndex:2];
[menu insertItemWithTitle:@"baz" action:nil keyEquivalent:@"" atIndex:3];
-
+
[button_ setAttachedMenu:menu];
EXPECT_TRUE([button_ attachedMenu]);
Property changes on: chrome/browser/cocoa/menu_button_unittest.mm
___________________________________________________________________
Added: svn:eol-style
+ LF
« no previous file with comments | « chrome/browser/cocoa/infobar_gradient_view_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698