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

Unified Diff: chrome/browser/cocoa/find_bar_view_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/find_bar_view_unittest.mm
===================================================================
--- chrome/browser/cocoa/find_bar_view_unittest.mm (revision 32421)
+++ chrome/browser/cocoa/find_bar_view_unittest.mm (working copy)
@@ -27,31 +27,21 @@
namespace {
-class FindBarViewTest : public PlatformTest {
+class FindBarViewTest : public CocoaTest {
public:
FindBarViewTest() {
NSRect frame = NSMakeRect(0, 0, 100, 30);
- view_.reset([[FindBarView alloc] initWithFrame:frame]);
- [cocoa_helper_.contentView() addSubview:view_.get()];
+ scoped_nsobject<FindBarView> view(
+ [[FindBarView alloc] initWithFrame:frame]);
+ view_ = view.get();
+ [[test_window() contentView] addSubview:view_];
}
- scoped_nsobject<FindBarView> view_;
- CocoaTestHelper cocoa_helper_; // Inits Cocoa, creates window, etc...
+ FindBarView* view_;
};
-// Test adding/removing from the view hierarchy, mostly to ensure nothing
-// leaks or crashes.
-TEST_F(FindBarViewTest, AddRemove) {
- EXPECT_EQ(cocoa_helper_.contentView(), [view_ superview]);
- [view_.get() removeFromSuperview];
- EXPECT_FALSE([view_ superview]);
-}
+TEST_VIEW(FindBarViewTest, view_)
-// Test drawing, mostly to ensure nothing leaks or crashes.
-TEST_F(FindBarViewTest, Display) {
- [view_ display];
-}
-
TEST_F(FindBarViewTest, FindBarEatsMouseClicksInBackgroundArea) {
MouseDownViewPong* pongView =
[[MouseDownViewPong alloc] initWithFrame:NSMakeRect(0, 0, 200, 200)];
@@ -63,15 +53,15 @@
[view_ setFrame:NSMakeRect(0, 0, 200, 200)];
// Add the pong view as a sibling of the findbar.
- [cocoa_helper_.contentView() addSubview:pongView
+ [[test_window() contentView] addSubview:pongView
positioned:NSWindowBelow
- relativeTo:view_.get()];
+ relativeTo:view_];
// Synthesize a mousedown event and send it to the window. The event is
// placed in the center of the find bar.
NSPoint pointInCenterOfFindBar = NSMakePoint(100, 100);
[pongView setPong:NO];
- [cocoa_helper_.window()
+ [test_window()
sendEvent:test_event_utils::LeftMouseDownAtPoint(pointInCenterOfFindBar)];
// Click gets eaten by findbar, not passed through to underlying view.
EXPECT_FALSE([pongView pong]);
@@ -83,16 +73,16 @@
[view_ setFrame:NSMakeRect(0, 0, 200, 200)];
// Add the pong view as a sibling of the findbar.
- [cocoa_helper_.contentView() addSubview:pongView
+ [[test_window() contentView] addSubview:pongView
positioned:NSWindowBelow
- relativeTo:view_.get()];
+ relativeTo:view_];
// Synthesize a mousedown event and send it to the window. The event is inset
// a few pixels from the lower left corner of the window, which places it in
// the transparent area surrounding the findbar.
NSPoint pointInTransparentArea = NSMakePoint(2, 2);
[pongView setPong:NO];
- [cocoa_helper_.window()
+ [test_window()
sendEvent:test_event_utils::LeftMouseDownAtPoint(pointInTransparentArea)];
// Click is ignored by findbar, passed through to underlying view.
EXPECT_TRUE([pongView pong]);
« no previous file with comments | « chrome/browser/cocoa/find_bar_cocoa_controller_unittest.mm ('k') | chrome/browser/cocoa/find_pasteboard_unittest.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698