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

Side by Side Diff: content/browser/media/webrtc_browsertest.cc

Issue 190563002: Refactored how WebRTC content browser tests talk to their javascript. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed AEC dump tests on Andri Created 6 years, 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/strings/stringprintf.h" 6 #include "base/strings/stringprintf.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "content/browser/media/webrtc_internals.h" 8 #include "content/browser/media/webrtc_internals.h"
9 #include "content/browser/web_contents/web_contents_impl.h" 9 #include "content/browser/web_contents/web_contents_impl.h"
10 #include "content/public/common/content_switches.h" 10 #include "content/public/common/content_switches.h"
(...skipping 16 matching lines...) Expand all
27 WebRtcBrowserTest() {} 27 WebRtcBrowserTest() {}
28 virtual ~WebRtcBrowserTest() {} 28 virtual ~WebRtcBrowserTest() {}
29 29
30 // Convenience function since most peerconnection-call.html tests just load 30 // Convenience function since most peerconnection-call.html tests just load
31 // the page, kick off some javascript and wait for the title to change to OK. 31 // the page, kick off some javascript and wait for the title to change to OK.
32 void MakeTypicalPeerConnectionCall(const std::string& javascript) { 32 void MakeTypicalPeerConnectionCall(const std::string& javascript) {
33 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); 33 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
34 34
35 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 35 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
36 NavigateToURL(shell(), url); 36 NavigateToURL(shell(), url);
37 ExecuteTestAndWaitForOk(javascript); 37
38 DisableOpusIfOnAndroid();
39 ExecuteJavascriptAndWaitForOk(javascript);
38 } 40 }
39 41
40 void ExecuteTestAndWaitForOk(const std::string& javascript) { 42 void DisableOpusIfOnAndroid() {
41 #if defined (OS_ANDROID) 43 #if defined (OS_ANDROID)
42 // Always force iSAC 16K on Android for now (Opus is broken). 44 // Always force iSAC 16K on Android for now (Opus is broken).
43 ASSERT_TRUE(ExecuteJavascript("forceIsac16KInSdp();")); 45 EXPECT_EQ("isac-forced",
46 ExecuteJavascriptAndReturnResult("forceIsac16KInSdp();"));
44 #endif 47 #endif
45
46 ASSERT_TRUE(ExecuteJavascript(javascript));
47 ExpectTitle("OK");
48 } 48 }
49 }; 49 };
50 50
51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
52 // Timing out on ARM linux bot: http://crbug.com/238490 52 // Timing out on ARM linux bot: http://crbug.com/238490
53 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall 53 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall
54 #else 54 #else
55 #define MAYBE_CanSetupVideoCall CanSetupVideoCall 55 #define MAYBE_CanSetupVideoCall CanSetupVideoCall
56 #endif 56 #endif
57 57
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 324
325 base::FilePath dump_file; 325 base::FilePath dump_file;
326 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 326 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
327 327
328 // This fakes the behavior of another open tab with webrtc-internals, and 328 // This fakes the behavior of another open tab with webrtc-internals, and
329 // enabling AEC dump in that tab. 329 // enabling AEC dump in that tab.
330 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); 330 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
331 331
332 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 332 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
333 NavigateToURL(shell(), url); 333 NavigateToURL(shell(), url);
334 ExecuteTestAndWaitForOk("call({video: true, audio: true});"); 334 DisableOpusIfOnAndroid();
335 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
335 336
336 EXPECT_TRUE(base::PathExists(dump_file)); 337 EXPECT_TRUE(base::PathExists(dump_file));
337 int64 file_size = 0; 338 int64 file_size = 0;
338 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); 339 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
339 EXPECT_GT(file_size, 0); 340 EXPECT_GT(file_size, 0);
340 341
341 base::DeleteFile(dump_file, false); 342 base::DeleteFile(dump_file, false);
342 } 343 }
343 344
344 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 345 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
(...skipping 15 matching lines...) Expand all
360 base::FilePath dump_file; 361 base::FilePath dump_file;
361 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 362 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
362 363
363 // This fakes the behavior of another open tab with webrtc-internals, and 364 // This fakes the behavior of another open tab with webrtc-internals, and
364 // enabling AEC dump in that tab, then disabling it. 365 // enabling AEC dump in that tab, then disabling it.
365 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); 366 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
366 WebRTCInternals::GetInstance()->DisableAecDump(); 367 WebRTCInternals::GetInstance()->DisableAecDump();
367 368
368 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 369 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
369 NavigateToURL(shell(), url); 370 NavigateToURL(shell(), url);
370 ExecuteTestAndWaitForOk("call({video: true, audio: true});"); 371 DisableOpusIfOnAndroid();
372 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
371 373
372 EXPECT_TRUE(base::PathExists(dump_file)); 374 EXPECT_TRUE(base::PathExists(dump_file));
373 int64 file_size = 0; 375 int64 file_size = 0;
374 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); 376 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
375 EXPECT_EQ(0, file_size); 377 EXPECT_EQ(0, file_size);
376 378
377 base::DeleteFile(dump_file, false); 379 base::DeleteFile(dump_file, false);
378 } 380 }
379 381
380 } // namespace content 382 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/media/webrtc_aecdump_browsertest.cc ('k') | content/browser/media/webrtc_getusermedia_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698