| 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/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/thread_task_runner_handle.h" | 6 #include "base/thread_task_runner_handle.h" |
| 7 #include "chrome/browser/ui/browser.h" | 7 #include "chrome/browser/ui/browser.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 26 matching lines...) Expand all Loading... |
| 37 ASSERT_TRUE(browser_actions_container); | 37 ASSERT_TRUE(browser_actions_container); |
| 38 | 38 |
| 39 media_router_action_.reset(new MediaRouterAction(browser())); | 39 media_router_action_.reset(new MediaRouterAction(browser())); |
| 40 | 40 |
| 41 // Sets delegate on |media_router_action_|. | 41 // Sets delegate on |media_router_action_|. |
| 42 toolbar_action_view_.reset( | 42 toolbar_action_view_.reset( |
| 43 new ToolbarActionView(media_router_action_.get(), browser()->profile(), | 43 new ToolbarActionView(media_router_action_.get(), browser()->profile(), |
| 44 browser_actions_container)); | 44 browser_actions_container)); |
| 45 } | 45 } |
| 46 | 46 |
| 47 void TearDownOnMainThread() override { |
| 48 toolbar_action_view_.reset(); |
| 49 media_router_action_.reset(); |
| 50 InProcessBrowserTest::TearDownOnMainThread(); |
| 51 } |
| 52 |
| 47 void OpenMediaRouterDialogAndWaitForNewWebContents() { | 53 void OpenMediaRouterDialogAndWaitForNewWebContents() { |
| 48 content::TestNavigationObserver nav_observer(NULL); | 54 content::TestNavigationObserver nav_observer(NULL); |
| 49 nav_observer.StartWatchingNewWebContents(); | 55 nav_observer.StartWatchingNewWebContents(); |
| 50 | 56 |
| 51 ToolbarView* toolbar = | 57 ToolbarView* toolbar = |
| 52 BrowserView::GetBrowserViewForBrowser(browser())->toolbar(); | 58 BrowserView::GetBrowserViewForBrowser(browser())->toolbar(); |
| 53 | 59 |
| 54 // When the Media Router Action executes, it opens a dialog with web | 60 // When the Media Router Action executes, it opens a dialog with web |
| 55 // contents to chrome://media-router. | 61 // contents to chrome://media-router. |
| 56 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 62 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 99 | 105 |
| 100 // Navigate away. | 106 // Navigate away. |
| 101 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); | 107 ui_test_utils::NavigateToURL(browser(), GURL("about:blank")); |
| 102 | 108 |
| 103 // The navigation should have removed the previously created dialog. | 109 // The navigation should have removed the previously created dialog. |
| 104 // We expect a new dialog WebContents to be created by calling this. | 110 // We expect a new dialog WebContents to be created by calling this. |
| 105 OpenMediaRouterDialogAndWaitForNewWebContents(); | 111 OpenMediaRouterDialogAndWaitForNewWebContents(); |
| 106 } | 112 } |
| 107 | 113 |
| 108 } // namespace media_router | 114 } // namespace media_router |
| OLD | NEW |