| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 #include "base/macros.h" | 5 #include "base/macros.h" |
| 6 #include "chrome/browser/extensions/browser_action_test_util.h" | 6 #include "chrome/browser/extensions/browser_action_test_util.h" |
| 7 #include "chrome/browser/extensions/extension_action_test_util.h" | 7 #include "chrome/browser/extensions/extension_action_test_util.h" |
| 8 #include "chrome/browser/ui/browser_commands.h" | 8 #include "chrome/browser/ui/browser_commands.h" |
| 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 9 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 10 #include "chrome/browser/ui/toolbar/media_router_action.h" | 10 #include "chrome/browser/ui/toolbar/media_router_action.h" |
| (...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 163 const { | 163 const { |
| 164 return non_local_display_route_list_; | 164 return non_local_display_route_list_; |
| 165 } | 165 } |
| 166 const std::vector<media_router::MediaRoute::Id>& empty_route_id_list() const { | 166 const std::vector<media_router::MediaRoute::Id>& empty_route_id_list() const { |
| 167 return empty_route_id_list_; | 167 return empty_route_id_list_; |
| 168 } | 168 } |
| 169 | 169 |
| 170 private: | 170 private: |
| 171 // A BrowserActionTestUtil object constructed with the associated | 171 // A BrowserActionTestUtil object constructed with the associated |
| 172 // ToolbarActionsBar. | 172 // ToolbarActionsBar. |
| 173 scoped_ptr<BrowserActionTestUtil> browser_action_test_util_; | 173 std::unique_ptr<BrowserActionTestUtil> browser_action_test_util_; |
| 174 | 174 |
| 175 scoped_ptr<TestMediaRouterAction> action_; | 175 std::unique_ptr<TestMediaRouterAction> action_; |
| 176 | 176 |
| 177 // The associated ToolbarActionsModel (owned by the keyed service setup). | 177 // The associated ToolbarActionsModel (owned by the keyed service setup). |
| 178 ToolbarActionsModel* toolbar_model_; | 178 ToolbarActionsModel* toolbar_model_; |
| 179 | 179 |
| 180 // Fake Issues. | 180 // Fake Issues. |
| 181 const media_router::Issue fake_issue_notification_; | 181 const media_router::Issue fake_issue_notification_; |
| 182 const media_router::Issue fake_issue_warning_; | 182 const media_router::Issue fake_issue_warning_; |
| 183 const media_router::Issue fake_issue_fatal_; | 183 const media_router::Issue fake_issue_fatal_; |
| 184 | 184 |
| 185 // Fake Sources, used for the Routes. | 185 // Fake Sources, used for the Routes. |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 | 329 |
| 330 MediaRouterDialogControllerImpl::CreateForWebContents(initiator_); | 330 MediaRouterDialogControllerImpl::CreateForWebContents(initiator_); |
| 331 MediaRouterDialogControllerImpl* dialog_controller_ = | 331 MediaRouterDialogControllerImpl* dialog_controller_ = |
| 332 MediaRouterDialogControllerImpl::FromWebContents(initiator_); | 332 MediaRouterDialogControllerImpl::FromWebContents(initiator_); |
| 333 ASSERT_TRUE(dialog_controller_); | 333 ASSERT_TRUE(dialog_controller_); |
| 334 | 334 |
| 335 // Sets the controller to use for TestMediaRouterAction. | 335 // Sets the controller to use for TestMediaRouterAction. |
| 336 action()->SetMediaRouterDialogController(dialog_controller_); | 336 action()->SetMediaRouterDialogController(dialog_controller_); |
| 337 | 337 |
| 338 // Create a ToolbarActionViewDelegate to use for MediaRouterAction. | 338 // Create a ToolbarActionViewDelegate to use for MediaRouterAction. |
| 339 scoped_ptr<MockToolbarActionViewDelegate> mock_delegate( | 339 std::unique_ptr<MockToolbarActionViewDelegate> mock_delegate( |
| 340 new MockToolbarActionViewDelegate()); | 340 new MockToolbarActionViewDelegate()); |
| 341 | 341 |
| 342 EXPECT_CALL(*mock_delegate, GetCurrentWebContents()).WillOnce( | 342 EXPECT_CALL(*mock_delegate, GetCurrentWebContents()).WillOnce( |
| 343 testing::Return(initiator_)); | 343 testing::Return(initiator_)); |
| 344 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); | 344 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); |
| 345 action()->SetDelegate(mock_delegate.get()); | 345 action()->SetDelegate(mock_delegate.get()); |
| 346 | 346 |
| 347 EXPECT_CALL(*mock_delegate, OnPopupShown(true)).Times(1); | 347 EXPECT_CALL(*mock_delegate, OnPopupShown(true)).Times(1); |
| 348 action()->ExecuteAction(true); | 348 action()->ExecuteAction(true); |
| 349 | 349 |
| 350 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); | 350 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); |
| 351 dialog_controller_->HideMediaRouterDialog(); | 351 dialog_controller_->HideMediaRouterDialog(); |
| 352 | 352 |
| 353 EXPECT_CALL(*mock_delegate, OnPopupShown(true)).Times(1); | 353 EXPECT_CALL(*mock_delegate, OnPopupShown(true)).Times(1); |
| 354 dialog_controller_->CreateMediaRouterDialog(); | 354 dialog_controller_->CreateMediaRouterDialog(); |
| 355 | 355 |
| 356 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); | 356 EXPECT_CALL(*mock_delegate, OnPopupClosed()).Times(1); |
| 357 dialog_controller_->HideMediaRouterDialog(); | 357 dialog_controller_->HideMediaRouterDialog(); |
| 358 } | 358 } |
| OLD | NEW |