gpu: Tweak Android WebGL test expectations
[chromium-blink-merge.git] / ui / app_list / cocoa / app_list_window_controller_unittest.mm
blob68b273d71a28410a9e3a23f8499fb66d23a254e0
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
3 // found in the LICENSE file.
5 #import "base/mac/scoped_nsobject.h"
6 #import "testing/gtest_mac.h"
7 #include "ui/app_list/app_list_view_delegate.h"
8 #import "ui/app_list/cocoa/app_list_view_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"
11 #import "ui/base/test/ui_cocoa_test_helper.h"
13 namespace {
15 class AppListWindowControllerTest : public ui::CocoaTest {
16  public:
17   AppListWindowControllerTest();
19  protected:
20   virtual void TearDown() OVERRIDE;
22   base::scoped_nsobject<AppListWindowController> controller_;
24   app_list::test::AppListTestViewDelegate* delegate() {
25     return static_cast<app_list::test::AppListTestViewDelegate*>(
26         [[controller_ appListViewController] delegate]);
27   }
29  private:
30   DISALLOW_COPY_AND_ASSIGN(AppListWindowControllerTest);
33 AppListWindowControllerTest::AppListWindowControllerTest() {
34   Init();
35   scoped_ptr<app_list::AppListViewDelegate> delegate(
36       new app_list::test::AppListTestViewDelegate);
37   controller_.reset([[AppListWindowController alloc] init]);
38   [[controller_ appListViewController] setDelegate:delegate.Pass()];
41 void AppListWindowControllerTest::TearDown() {
42   EXPECT_TRUE(controller_.get());
43   [[controller_ window] close];
44   [[controller_ appListViewController]
45      setDelegate:scoped_ptr<app_list::AppListViewDelegate>()];
46   controller_.reset();
47   ui::CocoaTest::TearDown();
50 }  // namespace
52 // Test showing, hiding and closing the app list window.
53 TEST_F(AppListWindowControllerTest, ShowHideCloseRelease) {
54   EXPECT_TRUE([controller_ window]);
55   [[controller_ window] makeKeyAndOrderFront:nil];
56   EXPECT_TRUE([[controller_ window] isVisible]);
57   EXPECT_TRUE([[[controller_ window] contentView] superview]);
58   [[controller_ window] close];  // Hide.
59   EXPECT_FALSE([[controller_ window] isVisible]);
60   [[controller_ window] makeKeyAndOrderFront:nil];
63 // Test that the key bound to cancel (usually Escape) asks the controller to
64 // dismiss the window.
65 TEST_F(AppListWindowControllerTest, DismissWithEscape) {
66   [[controller_ window] makeKeyAndOrderFront:nil];
67   EXPECT_EQ(0, delegate()->dismiss_count());
68   [[controller_ window] cancelOperation:controller_];
69   EXPECT_EQ(1, delegate()->dismiss_count());