| 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 "base/mac/scoped_nsobject.h" | 7 #include "base/mac/scoped_nsobject.h" |
| 8 #include "base/message_loop/message_loop.h" | 8 #include "base/message_loop/message_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "base/strings/utf_string_conversions.h" | 11 #include "base/strings/utf_string_conversions.h" |
| 12 #import "testing/gtest_mac.h" | 12 #import "testing/gtest_mac.h" |
| 13 #include "ui/app_list/search_result.h" | |
| 14 #include "ui/app_list/test/app_list_test_model.h" | 13 #include "ui/app_list/test/app_list_test_model.h" |
| 14 #include "ui/app_list/test/test_search_result.h" |
| 15 #include "ui/base/models/simple_menu_model.h" | 15 #include "ui/base/models/simple_menu_model.h" |
| 16 #import "ui/events/test/cocoa_test_event_utils.h" | 16 #import "ui/events/test/cocoa_test_event_utils.h" |
| 17 #include "ui/gfx/image/image_skia_util_mac.h" | 17 #include "ui/gfx/image/image_skia_util_mac.h" |
| 18 #import "ui/gfx/test/ui_cocoa_test_helper.h" | 18 #import "ui/gfx/test/ui_cocoa_test_helper.h" |
| 19 | 19 |
| 20 @interface TestAppsSearchResultsDelegate : NSObject<AppsSearchResultsDelegate> { | 20 @interface TestAppsSearchResultsDelegate : NSObject<AppsSearchResultsDelegate> { |
| 21 @private | 21 @private |
| 22 app_list::test::AppListTestModel appListModel_; | 22 app_list::test::AppListTestModel appListModel_; |
| 23 app_list::SearchResult* lastOpenedResult_; | 23 app_list::SearchResult* lastOpenedResult_; |
| 24 int redoSearchCount_; | 24 int redoSearchCount_; |
| (...skipping 28 matching lines...) Expand all Loading... |
| 53 } | 53 } |
| 54 | 54 |
| 55 @end | 55 @end |
| 56 | 56 |
| 57 namespace app_list { | 57 namespace app_list { |
| 58 namespace test { | 58 namespace test { |
| 59 namespace { | 59 namespace { |
| 60 | 60 |
| 61 const int kDefaultResultsCount = 3; | 61 const int kDefaultResultsCount = 3; |
| 62 | 62 |
| 63 class SearchResultWithMenu : public SearchResult { | 63 class SearchResultWithMenu : public TestSearchResult { |
| 64 public: | 64 public: |
| 65 SearchResultWithMenu(const std::string& title, const std::string& details) | 65 SearchResultWithMenu(const std::string& title, const std::string& details) |
| 66 : menu_model_(NULL), | 66 : menu_model_(NULL), |
| 67 menu_ready_(true) { | 67 menu_ready_(true) { |
| 68 set_title(base::ASCIIToUTF16(title)); | 68 set_title(base::ASCIIToUTF16(title)); |
| 69 set_details(base::ASCIIToUTF16(details)); | 69 set_details(base::ASCIIToUTF16(details)); |
| 70 menu_model_.AddItem(0, base::UTF8ToUTF16("Menu For: " + title)); | 70 menu_model_.AddItem(0, base::UTF8ToUTF16("Menu For: " + title)); |
| 71 } | 71 } |
| 72 | 72 |
| 73 void SetMenuReadyForTesting(bool ready) { | 73 void SetMenuReadyForTesting(bool ready) { |
| (...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 307 ModelResultAt(0)->NotifyItemUninstalled(); | 307 ModelResultAt(0)->NotifyItemUninstalled(); |
| 308 [delegate_ performSelector:@selector(quitMessageLoop) | 308 [delegate_ performSelector:@selector(quitMessageLoop) |
| 309 withObject:nil | 309 withObject:nil |
| 310 afterDelay:0]; | 310 afterDelay:0]; |
| 311 message_loop.Run(); | 311 message_loop.Run(); |
| 312 EXPECT_EQ(1, [delegate_ redoSearchCount]); | 312 EXPECT_EQ(1, [delegate_ redoSearchCount]); |
| 313 } | 313 } |
| 314 | 314 |
| 315 } // namespace test | 315 } // namespace test |
| 316 } // namespace app_list | 316 } // namespace app_list |
| OLD | NEW |