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/memory/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" |
11 #include "ui/app_list/app_list_menu.h" | 11 #include "ui/app_list/app_list_menu.h" |
12 #import "ui/app_list/cocoa/current_user_menu_item_view.h" | 12 #import "ui/app_list/cocoa/current_user_menu_item_view.h" |
13 #include "ui/app_list/search_box_model.h" | 13 #include "ui/app_list/search_box_model.h" |
14 #include "ui/app_list/test/app_list_test_model.h" | 14 #include "ui/app_list/test/app_list_test_model.h" |
15 #include "ui/app_list/test/app_list_test_view_delegate.h" | 15 #include "ui/app_list/test/app_list_test_view_delegate.h" |
16 #import "ui/base/test/ui_cocoa_test_helper.h" | 16 #import "ui/base/test/ui_cocoa_test_helper.h" |
17 | 17 |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
80 } | 80 } |
81 | 81 |
82 void SimulateKeyAction(SEL c) { | 82 void SimulateKeyAction(SEL c) { |
83 NSControl* control = [apps_search_box_controller_ searchTextField]; | 83 NSControl* control = [apps_search_box_controller_ searchTextField]; |
84 [apps_search_box_controller_ control:control | 84 [apps_search_box_controller_ control:control |
85 textView:nil | 85 textView:nil |
86 doCommandBySelector:c]; | 86 doCommandBySelector:c]; |
87 } | 87 } |
88 | 88 |
89 protected: | 89 protected: |
90 scoped_nsobject<TestAppsSearchBoxDelegate> delegate_; | 90 base::scoped_nsobject<TestAppsSearchBoxDelegate> delegate_; |
91 scoped_nsobject<AppsSearchBoxController> apps_search_box_controller_; | 91 base::scoped_nsobject<AppsSearchBoxController> apps_search_box_controller_; |
92 | 92 |
93 private: | 93 private: |
94 DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxControllerTest); | 94 DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxControllerTest); |
95 }; | 95 }; |
96 | 96 |
97 TEST_VIEW(AppsSearchBoxControllerTest, [apps_search_box_controller_ view]); | 97 TEST_VIEW(AppsSearchBoxControllerTest, [apps_search_box_controller_ view]); |
98 | 98 |
99 // Test the search box initialization, and search input and clearing. | 99 // Test the search box initialization, and search input and clearing. |
100 TEST_F(AppsSearchBoxControllerTest, SearchBoxModel) { | 100 TEST_F(AppsSearchBoxControllerTest, SearchBoxModel) { |
101 app_list::SearchBoxModel* model = [delegate_ searchBoxModel]; | 101 app_list::SearchBoxModel* model = [delegate_ searchBoxModel]; |
(...skipping 67 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 | 169 |
170 virtual void SetUp() OVERRIDE { | 170 virtual void SetUp() OVERRIDE { |
171 scoped_ptr<AppListViewDelegate> delegate(new AppListTestViewDelegate); | 171 scoped_ptr<AppListViewDelegate> delegate(new AppListTestViewDelegate); |
172 current_user_menu_item_.reset([[[CurrentUserMenuItemView alloc] | 172 current_user_menu_item_.reset([[[CurrentUserMenuItemView alloc] |
173 initWithDelegate:delegate.get()] retain]); | 173 initWithDelegate:delegate.get()] retain]); |
174 ui::CocoaTest::SetUp(); | 174 ui::CocoaTest::SetUp(); |
175 [[test_window() contentView] addSubview:current_user_menu_item_]; | 175 [[test_window() contentView] addSubview:current_user_menu_item_]; |
176 } | 176 } |
177 | 177 |
178 protected: | 178 protected: |
179 scoped_nsobject<NSView> current_user_menu_item_; | 179 base::scoped_nsobject<NSView> current_user_menu_item_; |
180 | 180 |
181 private: | 181 private: |
182 DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxCustomMenuItemTest); | 182 DISALLOW_COPY_AND_ASSIGN(AppsSearchBoxCustomMenuItemTest); |
183 }; | 183 }; |
184 | 184 |
185 TEST_VIEW(AppsSearchBoxCustomMenuItemTest, current_user_menu_item_); | 185 TEST_VIEW(AppsSearchBoxCustomMenuItemTest, current_user_menu_item_); |
186 | 186 |
187 } // namespace test | 187 } // namespace test |
188 } // namespace app_list | 188 } // namespace app_list |
OLD | NEW |