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

Side by Side Diff: ui/app_list/cocoa/app_list_window_controller_unittest.mm

Issue 17769005: Rewrite scoped_ptr<T>(NULL) to use the default ctor. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 5 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « ui/app_list/cocoa/app_list_view_controller_unittest.mm ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 "base/mac/scoped_nsobject.h" 5 #import "base/mac/scoped_nsobject.h"
6 #import "testing/gtest_mac.h" 6 #import "testing/gtest_mac.h"
7 #include "ui/app_list/app_list_view_delegate.h" 7 #include "ui/app_list/app_list_view_delegate.h"
8 #import "ui/app_list/cocoa/app_list_view_controller.h" 8 #import "ui/app_list/cocoa/app_list_view_controller.h"
9 #import "ui/app_list/cocoa/app_list_window_controller.h" 9 #import "ui/app_list/cocoa/app_list_window_controller.h"
10 #include "ui/app_list/test/app_list_test_view_delegate.h" 10 #include "ui/app_list/test/app_list_test_view_delegate.h"
(...skipping 24 matching lines...) Expand all
35 scoped_ptr<app_list::AppListViewDelegate> delegate( 35 scoped_ptr<app_list::AppListViewDelegate> delegate(
36 new app_list::test::AppListTestViewDelegate); 36 new app_list::test::AppListTestViewDelegate);
37 controller_.reset([[AppListWindowController alloc] init]); 37 controller_.reset([[AppListWindowController alloc] init]);
38 [[controller_ appListViewController] setDelegate:delegate.Pass()]; 38 [[controller_ appListViewController] setDelegate:delegate.Pass()];
39 } 39 }
40 40
41 void AppListWindowControllerTest::TearDown() { 41 void AppListWindowControllerTest::TearDown() {
42 EXPECT_TRUE(controller_.get()); 42 EXPECT_TRUE(controller_.get());
43 [[controller_ window] close]; 43 [[controller_ window] close];
44 [[controller_ appListViewController] 44 [[controller_ appListViewController]
45 setDelegate:scoped_ptr<app_list::AppListViewDelegate>(NULL)]; 45 setDelegate:scoped_ptr<app_list::AppListViewDelegate>()];
46 controller_.reset(); 46 controller_.reset();
47 ui::CocoaTest::TearDown(); 47 ui::CocoaTest::TearDown();
48 } 48 }
49 49
50 } // namespace 50 } // namespace
51 51
52 // Test showing, hiding and closing the app list window. 52 // Test showing, hiding and closing the app list window.
53 TEST_F(AppListWindowControllerTest, ShowHideCloseRelease) { 53 TEST_F(AppListWindowControllerTest, ShowHideCloseRelease) {
54 EXPECT_TRUE([controller_ window]); 54 EXPECT_TRUE([controller_ window]);
55 [[controller_ window] makeKeyAndOrderFront:nil]; 55 [[controller_ window] makeKeyAndOrderFront:nil];
56 EXPECT_TRUE([[controller_ window] isVisible]); 56 EXPECT_TRUE([[controller_ window] isVisible]);
57 EXPECT_TRUE([[[controller_ window] contentView] superview]); 57 EXPECT_TRUE([[[controller_ window] contentView] superview]);
58 [[controller_ window] close]; // Hide. 58 [[controller_ window] close]; // Hide.
59 EXPECT_FALSE([[controller_ window] isVisible]); 59 EXPECT_FALSE([[controller_ window] isVisible]);
60 [[controller_ window] makeKeyAndOrderFront:nil]; 60 [[controller_ window] makeKeyAndOrderFront:nil];
61 } 61 }
62 62
63 // Test that the key bound to cancel (usually Escape) asks the controller to 63 // Test that the key bound to cancel (usually Escape) asks the controller to
64 // dismiss the window. 64 // dismiss the window.
65 TEST_F(AppListWindowControllerTest, DismissWithEscape) { 65 TEST_F(AppListWindowControllerTest, DismissWithEscape) {
66 [[controller_ window] makeKeyAndOrderFront:nil]; 66 [[controller_ window] makeKeyAndOrderFront:nil];
67 EXPECT_EQ(0, delegate()->dismiss_count()); 67 EXPECT_EQ(0, delegate()->dismiss_count());
68 [[controller_ window] cancelOperation:controller_]; 68 [[controller_ window] cancelOperation:controller_];
69 EXPECT_EQ(1, delegate()->dismiss_count()); 69 EXPECT_EQ(1, delegate()->dismiss_count());
70 } 70 }
OLDNEW
« no previous file with comments | « ui/app_list/cocoa/app_list_view_controller_unittest.mm ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698