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

Side by Side Diff: chrome/browser/media/chrome_webrtc_apprtc_browsertest.cc

Issue 1161153003: Convert the WebRtcTestBase to use infobar and bubble autoresponders (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix MANUAL test Created 5 years, 6 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
OLDNEW
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 #include "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/files/file_enumerator.h" 6 #include "base/files/file_enumerator.h"
7 #include "base/path_service.h" 7 #include "base/path_service.h"
8 #include "base/process/launch.h" 8 #include "base/process/launch.h"
9 #include "base/rand_util.h" 9 #include "base/rand_util.h"
10 #include "base/strings/stringprintf.h" 10 #include "base/strings/stringprintf.h"
11 #include "chrome/browser/browser_process.h" 11 #include "chrome/browser/browser_process.h"
12 #include "chrome/browser/infobars/infobar_responder.h"
13 #include "chrome/browser/infobars/infobar_service.h"
12 #include "chrome/browser/media/webrtc_browsertest_base.h" 14 #include "chrome/browser/media/webrtc_browsertest_base.h"
13 #include "chrome/browser/media/webrtc_browsertest_common.h" 15 #include "chrome/browser/media/webrtc_browsertest_common.h"
14 #include "chrome/browser/ui/browser.h" 16 #include "chrome/browser/ui/browser.h"
15 #include "chrome/browser/ui/browser_tabstrip.h" 17 #include "chrome/browser/ui/browser_tabstrip.h"
16 #include "chrome/browser/ui/tabs/tab_strip_model.h" 18 #include "chrome/browser/ui/tabs/tab_strip_model.h"
19 #include "chrome/browser/ui/website_settings/permission_bubble_manager.h"
17 #include "chrome/common/chrome_switches.h" 20 #include "chrome/common/chrome_switches.h"
18 #include "chrome/test/base/ui_test_utils.h" 21 #include "chrome/test/base/ui_test_utils.h"
19 #include "content/public/test/browser_test_utils.h" 22 #include "content/public/test/browser_test_utils.h"
20 #include "media/base/media_switches.h" 23 #include "media/base/media_switches.h"
21 #include "net/test/python_utils.h" 24 #include "net/test/python_utils.h"
22 #include "ui/gl/gl_switches.h" 25 #include "ui/gl/gl_switches.h"
23 26
24 // You need this solution to run this test. The solution will download appengine 27 // You need this solution to run this test. The solution will download appengine
25 // and the apprtc code for you. 28 // and the apprtc code for you.
26 const char kAdviseOnGclientSolution[] = 29 const char kAdviseOnGclientSolution[] =
(...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after
239 242
240 DetectErrorsInJavaScript(); 243 DetectErrorsInJavaScript();
241 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); 244 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999"));
242 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); 245 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089"));
243 while (!LocalApprtcInstanceIsUp()) 246 while (!LocalApprtcInstanceIsUp())
244 DVLOG(1) << "Waiting for AppRTC to come up..."; 247 DVLOG(1) << "Waiting for AppRTC to come up...";
245 248
246 GURL room_url = GURL("http://localhost:9999/r/some_room" 249 GURL room_url = GURL("http://localhost:9999/r/some_room"
247 "?wshpp=localhost:8089&wstls=false"); 250 "?wshpp=localhost:8089&wstls=false");
248 251
252 // Set up the left tab.
249 chrome::AddTabAt(browser(), GURL(), -1, true); 253 chrome::AddTabAt(browser(), GURL(), -1, true);
250 content::WebContents* left_tab = OpenPageAndAcceptUserMedia(room_url); 254 content::WebContents* left_tab =
255 browser()->tab_strip_model()->GetActiveWebContents();
256 PermissionBubbleManager::FromWebContents(left_tab)
257 ->set_auto_response_for_test(PermissionBubbleManager::ACCEPT_ALL);
258 InfoBarResponder left_infobar_responder(
259 InfoBarService::FromWebContents(left_tab), InfoBarResponder::ACCEPT);
260 ui_test_utils::NavigateToURL(browser(), room_url);
251 261
262 // Set up the right tab.
252 chrome::AddTabAt(browser(), GURL(), -1, true); 263 chrome::AddTabAt(browser(), GURL(), -1, true);
253 content::WebContents* right_tab = OpenPageAndAcceptUserMedia(room_url); 264 content::WebContents* right_tab =
265 browser()->tab_strip_model()->GetActiveWebContents();
266 PermissionBubbleManager::FromWebContents(right_tab)
267 ->set_auto_response_for_test(PermissionBubbleManager::ACCEPT_ALL);
268 InfoBarResponder right_infobar_responder(
269 InfoBarService::FromWebContents(right_tab), InfoBarResponder::ACCEPT);
270 ui_test_utils::NavigateToURL(browser(), room_url);
254 271
255 ASSERT_TRUE(WaitForCallToComeUp(left_tab)); 272 ASSERT_TRUE(WaitForCallToComeUp(left_tab));
256 ASSERT_TRUE(WaitForCallToComeUp(right_tab)); 273 ASSERT_TRUE(WaitForCallToComeUp(right_tab));
257 274
258 ASSERT_TRUE(DetectRemoteVideoPlaying(left_tab)); 275 ASSERT_TRUE(DetectRemoteVideoPlaying(left_tab));
259 ASSERT_TRUE(DetectRemoteVideoPlaying(right_tab)); 276 ASSERT_TRUE(DetectRemoteVideoPlaying(right_tab));
260 277
261 chrome::CloseWebContents(browser(), left_tab, false); 278 chrome::CloseWebContents(browser(), left_tab, false);
262 chrome::CloseWebContents(browser(), right_tab, false); 279 chrome::CloseWebContents(browser(), right_tab, false);
263 } 280 }
(...skipping 13 matching lines...) Expand all
277 294
278 DetectErrorsInJavaScript(); 295 DetectErrorsInJavaScript();
279 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999")); 296 ASSERT_TRUE(LaunchApprtcInstanceOnLocalhost("9999"));
280 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089")); 297 ASSERT_TRUE(LaunchColliderOnLocalHost("http://localhost:9999", "8089"));
281 while (!LocalApprtcInstanceIsUp()) 298 while (!LocalApprtcInstanceIsUp())
282 DVLOG(1) << "Waiting for AppRTC to come up..."; 299 DVLOG(1) << "Waiting for AppRTC to come up...";
283 300
284 GURL room_url = GURL("http://localhost:9999/r/some_room" 301 GURL room_url = GURL("http://localhost:9999/r/some_room"
285 "?wshpp=localhost:8089&wstls=false" 302 "?wshpp=localhost:8089&wstls=false"
286 "&firefox_fake_device=1"); 303 "&firefox_fake_device=1");
287 content::WebContents* chrome_tab = OpenPageAndAcceptUserMedia(room_url); 304 chrome::AddTabAt(browser(), GURL(), -1, true);
305 content::WebContents* chrome_tab =
306 browser()->tab_strip_model()->GetActiveWebContents();
307 PermissionBubbleManager::FromWebContents(chrome_tab)
308 ->set_auto_response_for_test(PermissionBubbleManager::ACCEPT_ALL);
309 InfoBarResponder infobar_responder(
310 InfoBarService::FromWebContents(chrome_tab), InfoBarResponder::ACCEPT);
311 ui_test_utils::NavigateToURL(browser(), room_url);
288 312
289 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url)); 313 ASSERT_TRUE(LaunchFirefoxWithUrl(room_url));
290 314
291 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab)); 315 ASSERT_TRUE(WaitForCallToComeUp(chrome_tab));
292 316
293 // Ensure Firefox manages to send video our way. 317 // Ensure Firefox manages to send video our way.
294 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab)); 318 ASSERT_TRUE(DetectRemoteVideoPlaying(chrome_tab));
295 } 319 }
OLDNEW
« no previous file with comments | « chrome/browser/media/chrome_media_stream_infobar_browsertest.cc ('k') | chrome/browser/media/webrtc_browsertest_base.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698