| OLD | NEW |
| 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/memory/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" |
| 11 #import "ui/base/test/ui_cocoa_test_helper.h" | 11 #import "ui/base/test/ui_cocoa_test_helper.h" |
| 12 | 12 |
| 13 namespace { | 13 namespace { |
| 14 | 14 |
| 15 class AppListWindowControllerTest : public ui::CocoaTest { | 15 class AppListWindowControllerTest : public ui::CocoaTest { |
| 16 public: | 16 public: |
| 17 AppListWindowControllerTest(); | 17 AppListWindowControllerTest(); |
| 18 | 18 |
| 19 protected: | 19 protected: |
| 20 virtual void TearDown() OVERRIDE; | 20 virtual void TearDown() OVERRIDE; |
| 21 | 21 |
| 22 scoped_nsobject<AppListWindowController> controller_; | 22 base::scoped_nsobject<AppListWindowController> controller_; |
| 23 | 23 |
| 24 app_list::test::AppListTestViewDelegate* delegate() { | 24 app_list::test::AppListTestViewDelegate* delegate() { |
| 25 return static_cast<app_list::test::AppListTestViewDelegate*>( | 25 return static_cast<app_list::test::AppListTestViewDelegate*>( |
| 26 [[controller_ appListViewController] delegate]); | 26 [[controller_ appListViewController] delegate]); |
| 27 } | 27 } |
| 28 | 28 |
| 29 private: | 29 private: |
| 30 DISALLOW_COPY_AND_ASSIGN(AppListWindowControllerTest); | 30 DISALLOW_COPY_AND_ASSIGN(AppListWindowControllerTest); |
| 31 }; | 31 }; |
| 32 | 32 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 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 } |
| OLD | NEW |