Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(83)

Side by Side Diff: chrome/browser/ui/views/media_router/media_router_ui_browsertest.cc

Issue 2614413003: Fix the flakiness of MediaRouterUIBrowserTest.OpenDialogWithMediaRouterAction (Closed)
Patch Set: Remove TODO comment Created 3 years, 11 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/threading/thread_task_runner_handle.h" 6 #include "base/threading/thread_task_runner_handle.h"
7 #include "chrome/browser/extensions/browser_action_test_util.h" 7 #include "chrome/browser/extensions/browser_action_test_util.h"
8 #include "chrome/browser/media/router/media_router_ui_service.h" 8 #include "chrome/browser/media/router/media_router_ui_service.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_commands.h" 10 #include "chrome/browser/ui/browser_commands.h"
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
62 BrowserView::GetBrowserViewForBrowser(browser()) 62 BrowserView::GetBrowserViewForBrowser(browser())
63 ->toolbar() 63 ->toolbar()
64 ->app_menu_button(); 64 ->app_menu_button();
65 65
66 // When the Media Router Action executes, it opens a dialog with web 66 // When the Media Router Action executes, it opens a dialog with web
67 // contents to chrome://media-router. 67 // contents to chrome://media-router.
68 base::ThreadTaskRunnerHandle::Get()->PostTask( 68 base::ThreadTaskRunnerHandle::Get()->PostTask(
69 FROM_HERE, 69 FROM_HERE,
70 base::Bind(&MediaRouterUIBrowserTest::ExecuteMediaRouterAction, 70 base::Bind(&MediaRouterUIBrowserTest::ExecuteMediaRouterAction,
71 base::Unretained(this), app_menu_button)); 71 base::Unretained(this), app_menu_button));
72
73 base::RunLoop run_loop;
72 app_menu_button->ShowMenu(false); 74 app_menu_button->ShowMenu(false);
75 run_loop.RunUntilIdle();
73 76
74 nav_observer.Wait(); 77 nav_observer.Wait();
75 EXPECT_FALSE(app_menu_button->IsMenuShowing()); 78 EXPECT_FALSE(app_menu_button->IsMenuShowing());
76 ASSERT_EQ(chrome::kChromeUIMediaRouterURL, 79 ASSERT_EQ(chrome::kChromeUIMediaRouterURL,
77 nav_observer.last_navigation_url().spec()); 80 nav_observer.last_navigation_url().spec());
78 nav_observer.StopWatchingNewWebContents(); 81 nav_observer.StopWatchingNewWebContents();
79 } 82 }
80 83
81 MediaRouterAction* GetMediaRouterAction() { 84 MediaRouterAction* GetMediaRouterAction() {
82 return MediaRouterDialogControllerImpl::GetOrCreateForWebContents( 85 return MediaRouterDialogControllerImpl::GetOrCreateForWebContents(
(...skipping 23 matching lines...) Expand all
106 ToolbarActionsBar* toolbar_actions_bar_ = nullptr; 109 ToolbarActionsBar* toolbar_actions_bar_ = nullptr;
107 110
108 Issue issue_; 111 Issue issue_;
109 112
110 // A vector of MediaRoutes that includes a local route. 113 // A vector of MediaRoutes that includes a local route.
111 std::vector<MediaRoute> routes_; 114 std::vector<MediaRoute> routes_;
112 115
113 MediaRouterActionController* action_controller_ = nullptr; 116 MediaRouterActionController* action_controller_ = nullptr;
114 }; 117 };
115 118
116 // TODO(crbug.com/658005): Fails on multiple platforms.
117 IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest, 119 IN_PROC_BROWSER_TEST_F(MediaRouterUIBrowserTest,
118 DISABLED_OpenDialogWithMediaRouterAction) { 120 OpenDialogWithMediaRouterAction) {
119 // We start off at about:blank page. 121 // We start off at about:blank page.
120 // Make sure there is 1 tab and media router is enabled. 122 // Make sure there is 1 tab and media router is enabled.
121 ASSERT_EQ(1, browser()->tab_strip_model()->count()); 123 ASSERT_EQ(1, browser()->tab_strip_model()->count());
122 124
123 SetAlwaysShowActionPref(true); 125 SetAlwaysShowActionPref(true);
124 EXPECT_TRUE(ActionExists()); 126 EXPECT_TRUE(ActionExists());
125 127
126 OpenMediaRouterDialogAndWaitForNewWebContents(); 128 OpenMediaRouterDialogAndWaitForNewWebContents();
127 129
128 // Reload the browser and wait. 130 // Reload the browser and wait.
(...skipping 81 matching lines...) Expand 10 before | Expand all | Expand 10 after
210 action_controller_->OnRoutesUpdated(std::vector<MediaRoute>(), 212 action_controller_->OnRoutesUpdated(std::vector<MediaRoute>(),
211 std::vector<MediaRoute::Id>()); 213 std::vector<MediaRoute::Id>());
212 EXPECT_FALSE(ActionExists()); 214 EXPECT_FALSE(ActionExists());
213 action_controller_->OnRoutesUpdated(routes_, std::vector<MediaRoute::Id>()); 215 action_controller_->OnRoutesUpdated(routes_, std::vector<MediaRoute::Id>());
214 EXPECT_TRUE(ActionExists()); 216 EXPECT_TRUE(ActionExists());
215 browser2->window()->Close(); 217 browser2->window()->Close();
216 EXPECT_TRUE(ActionExists()); 218 EXPECT_TRUE(ActionExists());
217 } 219 }
218 220
219 } // namespace media_router 221 } // namespace media_router
OLDNEW
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698