Chromium Code Reviews| 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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 #include "chrome/browser/ui/browser_commands.h" | 6 #include "chrome/browser/ui/browser_commands.h" |
| 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 7 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 8 #include "chrome/browser/ui/toolbar/media_router_action.h" | 8 #include "chrome/browser/ui/toolbar/media_router_action.h" |
| 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" | 9 #include "chrome/browser/ui/toolbar/toolbar_action_view_delegate.h" |
| 10 #include "chrome/browser/ui/views/frame/browser_view.h" | 10 #include "chrome/browser/ui/views/frame/browser_view.h" |
| (...skipping 15 matching lines...) Expand all Loading... | |
| 26 | 26 |
| 27 void SetUpOnMainThread() override { | 27 void SetUpOnMainThread() override { |
| 28 InProcessBrowserTest::SetUpOnMainThread(); | 28 InProcessBrowserTest::SetUpOnMainThread(); |
| 29 | 29 |
| 30 BrowserActionsContainer* browser_actions_container = | 30 BrowserActionsContainer* browser_actions_container = |
| 31 BrowserView::GetBrowserViewForBrowser(browser()) | 31 BrowserView::GetBrowserViewForBrowser(browser()) |
| 32 ->toolbar() | 32 ->toolbar() |
| 33 ->browser_actions(); | 33 ->browser_actions(); |
| 34 ASSERT_TRUE(browser_actions_container); | 34 ASSERT_TRUE(browser_actions_container); |
| 35 | 35 |
| 36 media_router_action_.reset(new MediaRouterAction); | 36 media_router_action_.reset(new MediaRouterAction(browser())); |
| 37 | 37 |
| 38 // Sets delegate on |media_router_action_|. | 38 // Sets delegate on |media_router_action_|. |
| 39 toolbar_action_view_.reset( | 39 toolbar_action_view_.reset( |
| 40 new ToolbarActionView(media_router_action_.get(), browser()->profile(), | 40 new ToolbarActionView(media_router_action_.get(), browser()->profile(), |
| 41 browser_actions_container)); | 41 browser_actions_container)); |
| 42 } | 42 } |
| 43 | 43 |
| 44 void OpenMediaRouterDialogAndWaitForNewWebContents() { | 44 void OpenMediaRouterDialogAndWaitForNewWebContents() { |
| 45 content::TestNavigationObserver nav_observer(NULL); | 45 content::TestNavigationObserver nav_observer(NULL); |
| 46 nav_observer.StartWatchingNewWebContents(); | 46 nav_observer.StartWatchingNewWebContents(); |
| 47 media_router_action_->ExecuteAction(true); | 47 media_router_action_->ExecuteAction(true); |
| 48 | |
| 49 ToolbarView* toolbar = | |
| 50 BrowserView::GetBrowserViewForBrowser(browser())->toolbar(); | |
| 51 ASSERT_FALSE(toolbar->IsWrenchMenuShowing()); | |
|
Devlin
2015/07/14 21:31:07
... But the wrench menu is never opened, right? W
apacible
2015/07/16 16:52:11
... good point. Opening the wrench menu prior to t
| |
| 52 | |
| 48 nav_observer.Wait(); | 53 nav_observer.Wait(); |
| 49 nav_observer.StopWatchingNewWebContents(); | 54 nav_observer.StopWatchingNewWebContents(); |
| 50 } | 55 } |
| 51 | 56 |
| 52 protected: | 57 protected: |
| 53 // Must be initialized after |InProcessBrowserTest::SetUpOnMainThread|. | 58 // Must be initialized after |InProcessBrowserTest::SetUpOnMainThread|. |
| 54 scoped_ptr<MediaRouterAction> media_router_action_; | 59 scoped_ptr<MediaRouterAction> media_router_action_; |
| 55 | 60 |
| 56 // ToolbarActionView constructed to set the delegate on |mr_action|. | 61 // ToolbarActionView constructed to set the delegate on |mr_action|. |
| 57 scoped_ptr<ToolbarActionView> toolbar_action_view_; | 62 scoped_ptr<ToolbarActionView> toolbar_action_view_; |
| (...skipping 22 matching lines...) Expand all Loading... | |
| 80 browser()->tab_strip_model()->GetActiveWebContents(), 1); | 85 browser()->tab_strip_model()->GetActiveWebContents(), 1); |
| 81 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 86 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 82 nav_observer.Wait(); | 87 nav_observer.Wait(); |
| 83 | 88 |
| 84 // The navigation should have removed the previously created dialog. | 89 // The navigation should have removed the previously created dialog. |
| 85 // We expect a new dialog WebContents to be created by calling this. | 90 // We expect a new dialog WebContents to be created by calling this. |
| 86 OpenMediaRouterDialogAndWaitForNewWebContents(); | 91 OpenMediaRouterDialogAndWaitForNewWebContents(); |
| 87 } | 92 } |
| 88 | 93 |
| 89 } // namespace media_router | 94 } // namespace media_router |
| OLD | NEW |