| 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" |
| (...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 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) { |
| 74 menu_ready_ = ready; | 74 menu_ready_ = ready; |
| 75 } | 75 } |
| 76 | 76 |
| 77 virtual ui::MenuModel* GetContextMenuModel() OVERRIDE { | 77 virtual ui::MenuModel* GetContextMenuModel() override { |
| 78 if (!menu_ready_) | 78 if (!menu_ready_) |
| 79 return NULL; | 79 return NULL; |
| 80 | 80 |
| 81 return &menu_model_; | 81 return &menu_model_; |
| 82 } | 82 } |
| 83 | 83 |
| 84 private: | 84 private: |
| 85 ui::SimpleMenuModel menu_model_; | 85 ui::SimpleMenuModel menu_model_; |
| 86 bool menu_ready_; | 86 bool menu_ready_; |
| 87 | 87 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 116 result->SetMenuReadyForTesting(ready); | 116 result->SetMenuReadyForTesting(ready); |
| 117 } | 117 } |
| 118 | 118 |
| 119 BOOL SimulateKeyAction(SEL c) { | 119 BOOL SimulateKeyAction(SEL c) { |
| 120 return [apps_search_results_controller_ handleCommandBySelector:c]; | 120 return [apps_search_results_controller_ handleCommandBySelector:c]; |
| 121 } | 121 } |
| 122 | 122 |
| 123 void ExpectConsistent(); | 123 void ExpectConsistent(); |
| 124 | 124 |
| 125 // ui::CocoaTest overrides: | 125 // ui::CocoaTest overrides: |
| 126 virtual void SetUp() OVERRIDE; | 126 virtual void SetUp() override; |
| 127 virtual void TearDown() OVERRIDE; | 127 virtual void TearDown() override; |
| 128 | 128 |
| 129 protected: | 129 protected: |
| 130 base::scoped_nsobject<TestAppsSearchResultsDelegate> delegate_; | 130 base::scoped_nsobject<TestAppsSearchResultsDelegate> delegate_; |
| 131 base::scoped_nsobject<AppsSearchResultsController> | 131 base::scoped_nsobject<AppsSearchResultsController> |
| 132 apps_search_results_controller_; | 132 apps_search_results_controller_; |
| 133 | 133 |
| 134 private: | 134 private: |
| 135 DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsControllerTest); | 135 DISALLOW_COPY_AND_ASSIGN(AppsSearchResultsControllerTest); |
| 136 }; | 136 }; |
| 137 | 137 |
| (...skipping 169 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 |