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_results_controller.h" | 5 #import "ui/app_list/cocoa/apps_search_results_controller.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include "base/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 73 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
84 DISALLOW_COPY_AND_ASSIGN(SearchResultWithMenu); | 84 DISALLOW_COPY_AND_ASSIGN(SearchResultWithMenu); |
85 }; | 85 }; |
86 | 86 |
87 class AppsSearchResultsControllerTest : public ui::CocoaTest { | 87 class AppsSearchResultsControllerTest : public ui::CocoaTest { |
88 public: | 88 public: |
89 AppsSearchResultsControllerTest() {} | 89 AppsSearchResultsControllerTest() {} |
90 | 90 |
91 void AddTestResultAtIndex(size_t index, | 91 void AddTestResultAtIndex(size_t index, |
92 const std::string& title, | 92 const std::string& title, |
93 const std::string& details) { | 93 const std::string& details) { |
94 scoped_ptr<SearchResult> result(new SearchResultWithMenu(title, details)); | 94 std::unique_ptr<SearchResult> result( |
| 95 new SearchResultWithMenu(title, details)); |
95 AppListModel::SearchResults* results = [delegate_ appListModel]->results(); | 96 AppListModel::SearchResults* results = [delegate_ appListModel]->results(); |
96 results->AddAt(index, result.release()); | 97 results->AddAt(index, result.release()); |
97 } | 98 } |
98 | 99 |
99 SearchResult* ModelResultAt(size_t index) { | 100 SearchResult* ModelResultAt(size_t index) { |
100 return [delegate_ appListModel]->results()->GetItemAt(index); | 101 return [delegate_ appListModel]->results()->GetItemAt(index); |
101 } | 102 } |
102 | 103 |
103 NSCell* ViewResultAt(NSInteger index) { | 104 NSCell* ViewResultAt(NSInteger index) { |
104 NSTableView* table_view = [apps_search_results_controller_ tableView]; | 105 NSTableView* table_view = [apps_search_results_controller_ tableView]; |
(...skipping 186 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
291 EXPECT_EQ(nil, menu); | 292 EXPECT_EQ(nil, menu); |
292 | 293 |
293 SetMenuReadyAt(1, true); | 294 SetMenuReadyAt(1, true); |
294 menu = [table_view menuForEvent:mouse_in_row_1]; | 295 menu = [table_view menuForEvent:mouse_in_row_1]; |
295 EXPECT_EQ(1, [menu numberOfItems]); | 296 EXPECT_EQ(1, [menu numberOfItems]); |
296 EXPECT_NSEQ(@"Menu For: Result 1", [[menu itemAtIndex:0] title]); | 297 EXPECT_NSEQ(@"Menu For: Result 1", [[menu itemAtIndex:0] title]); |
297 } | 298 } |
298 | 299 |
299 } // namespace test | 300 } // namespace test |
300 } // namespace app_list | 301 } // namespace app_list |
OLD | NEW |