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

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: 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 ExecuteJavascriptAndWaitForOk(javascript);
38 }
39
40 void ExecuteTestAndWaitForOk(const std::string& javascript) {
41 #if defined (OS_ANDROID)
42 // Always force iSAC 16K on Android for now (Opus is broken).
43 ASSERT_TRUE(ExecuteJavascript("forceIsac16KInSdp();"));
44 #endif
45
46 ASSERT_TRUE(ExecuteJavascript(javascript));
47 ExpectTitle("OK");
48 } 38 }
49 }; 39 };
50 40
51 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 41 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
52 // Timing out on ARM linux bot: http://crbug.com/238490 42 // Timing out on ARM linux bot: http://crbug.com/238490
53 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall 43 #define MAYBE_CanSetupVideoCall DISABLED_CanSetupVideoCall
54 #else 44 #else
55 #define MAYBE_CanSetupVideoCall CanSetupVideoCall 45 #define MAYBE_CanSetupVideoCall CanSetupVideoCall
56 #endif 46 #endif
57 47
(...skipping 266 matching lines...) Expand 10 before | Expand all | Expand 10 after
324 314
325 base::FilePath dump_file; 315 base::FilePath dump_file;
326 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 316 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
327 317
328 // This fakes the behavior of another open tab with webrtc-internals, and 318 // This fakes the behavior of another open tab with webrtc-internals, and
329 // enabling AEC dump in that tab. 319 // enabling AEC dump in that tab.
330 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); 320 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
331 321
332 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 322 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
333 NavigateToURL(shell(), url); 323 NavigateToURL(shell(), url);
334 ExecuteTestAndWaitForOk("call({video: true, audio: true});"); 324 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
335 325
336 EXPECT_TRUE(base::PathExists(dump_file)); 326 EXPECT_TRUE(base::PathExists(dump_file));
337 int64 file_size = 0; 327 int64 file_size = 0;
338 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); 328 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
339 EXPECT_GT(file_size, 0); 329 EXPECT_GT(file_size, 0);
340 330
341 base::DeleteFile(dump_file, false); 331 base::DeleteFile(dump_file, false);
342 } 332 }
343 333
344 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY) 334 #if defined(OS_LINUX) && !defined(OS_CHROMEOS) && defined(ARCH_CPU_ARM_FAMILY)
(...skipping 15 matching lines...) Expand all
360 base::FilePath dump_file; 350 base::FilePath dump_file;
361 ASSERT_TRUE(CreateTemporaryFile(&dump_file)); 351 ASSERT_TRUE(CreateTemporaryFile(&dump_file));
362 352
363 // This fakes the behavior of another open tab with webrtc-internals, and 353 // This fakes the behavior of another open tab with webrtc-internals, and
364 // enabling AEC dump in that tab, then disabling it. 354 // enabling AEC dump in that tab, then disabling it.
365 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL); 355 WebRTCInternals::GetInstance()->FileSelected(dump_file, -1, NULL);
366 WebRTCInternals::GetInstance()->DisableAecDump(); 356 WebRTCInternals::GetInstance()->DisableAecDump();
367 357
368 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html")); 358 GURL url(embedded_test_server()->GetURL("/media/peerconnection-call.html"));
369 NavigateToURL(shell(), url); 359 NavigateToURL(shell(), url);
370 ExecuteTestAndWaitForOk("call({video: true, audio: true});"); 360 ExecuteJavascriptAndWaitForOk("call({video: true, audio: true});");
371 361
372 EXPECT_TRUE(base::PathExists(dump_file)); 362 EXPECT_TRUE(base::PathExists(dump_file));
373 int64 file_size = 0; 363 int64 file_size = 0;
374 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size)); 364 EXPECT_TRUE(base::GetFileSize(dump_file, &file_size));
375 EXPECT_EQ(0, file_size); 365 EXPECT_EQ(0, file_size);
376 366
377 base::DeleteFile(dump_file, false); 367 base::DeleteFile(dump_file, false);
378 } 368 }
379 369
380 } // namespace content 370 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698