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 "ui/app_list/cocoa/apps_search_box_controller.h" | 5 #import "ui/app_list/cocoa/apps_search_box_controller.h" |
6 | 6 |
7 #include "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
8 #include "base/strings/sys_string_conversions.h" | 8 #include "base/strings/sys_string_conversions.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #import "testing/gtest_mac.h" | 10 #import "testing/gtest_mac.h" |
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
81 | 81 |
82 namespace app_list { | 82 namespace app_list { |
83 namespace test { | 83 namespace test { |
84 | 84 |
85 class AppsSearchBoxControllerTest : public ui::CocoaTest { | 85 class AppsSearchBoxControllerTest : public ui::CocoaTest { |
86 public: | 86 public: |
87 AppsSearchBoxControllerTest() { | 87 AppsSearchBoxControllerTest() { |
88 Init(); | 88 Init(); |
89 } | 89 } |
90 | 90 |
91 virtual void SetUp() OVERRIDE { | 91 virtual void SetUp() override { |
92 apps_search_box_controller_.reset( | 92 apps_search_box_controller_.reset( |
93 [[AppsSearchBoxController alloc] initWithFrame: | 93 [[AppsSearchBoxController alloc] initWithFrame: |
94 NSMakeRect(0, 0, 400, 100)]); | 94 NSMakeRect(0, 0, 400, 100)]); |
95 delegate_.reset([[TestAppsSearchBoxDelegate alloc] init]); | 95 delegate_.reset([[TestAppsSearchBoxDelegate alloc] init]); |
96 [apps_search_box_controller_ setDelegate:delegate_]; | 96 [apps_search_box_controller_ setDelegate:delegate_]; |
97 | 97 |
98 ui::CocoaTest::SetUp(); | 98 ui::CocoaTest::SetUp(); |
99 [[test_window() contentView] addSubview:[apps_search_box_controller_ view]]; | 99 [[test_window() contentView] addSubview:[apps_search_box_controller_ view]]; |
100 } | 100 } |
101 | 101 |
102 virtual void TearDown() OVERRIDE { | 102 virtual void TearDown() override { |
103 [apps_search_box_controller_ setDelegate:nil]; | 103 [apps_search_box_controller_ setDelegate:nil]; |
104 ui::CocoaTest::TearDown(); | 104 ui::CocoaTest::TearDown(); |
105 } | 105 } |
106 | 106 |
107 void SimulateKeyAction(SEL c) { | 107 void SimulateKeyAction(SEL c) { |
108 NSControl* control = [apps_search_box_controller_ searchTextField]; | 108 NSControl* control = [apps_search_box_controller_ searchTextField]; |
109 [apps_search_box_controller_ control:control | 109 [apps_search_box_controller_ control:control |
110 textView:nil | 110 textView:nil |
111 doCommandBySelector:c]; | 111 doCommandBySelector:c]; |
112 } | 112 } |
(...skipping 145 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
258 // Should now be an extra item, and it should have correct titles. | 258 // Should now be an extra item, and it should have correct titles. |
259 EXPECT_EQ(3, [[menu_control menu] numberOfItems] - non_user_items); | 259 EXPECT_EQ(3, [[menu_control menu] numberOfItems] - non_user_items); |
260 EXPECT_NSEQ(base::SysUTF16ToNSString(users[0].name), | 260 EXPECT_NSEQ(base::SysUTF16ToNSString(users[0].name), |
261 [[[menu_control menu] itemAtIndex:1] title]); | 261 [[[menu_control menu] itemAtIndex:1] title]); |
262 EXPECT_NSEQ(base::SysUTF16ToNSString(new_user.name), | 262 EXPECT_NSEQ(base::SysUTF16ToNSString(new_user.name), |
263 [[[menu_control menu] itemAtIndex:3] title]); | 263 [[[menu_control menu] itemAtIndex:3] title]); |
264 } | 264 } |
265 | 265 |
266 } // namespace test | 266 } // namespace test |
267 } // namespace app_list | 267 } // namespace app_list |
OLD | NEW |