OLD | NEW |
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 <algorithm> | 5 #include <algorithm> |
6 #include <cmath> | 6 #include <cmath> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/callback_helpers.h" | 9 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 10 matching lines...) Expand all Loading... |
21 #include "media/cast/cast_config.h" | 21 #include "media/cast/cast_config.h" |
22 #include "media/cast/cast_environment.h" | 22 #include "media/cast/cast_environment.h" |
23 #include "media/cast/test/utility/audio_utility.h" | 23 #include "media/cast/test/utility/audio_utility.h" |
24 #include "media/cast/test/utility/default_config.h" | 24 #include "media/cast/test/utility/default_config.h" |
25 #include "media/cast/test/utility/in_process_receiver.h" | 25 #include "media/cast/test/utility/in_process_receiver.h" |
26 #include "media/cast/test/utility/net_utility.h" | 26 #include "media/cast/test/utility/net_utility.h" |
27 #include "media/cast/test/utility/standalone_cast_environment.h" | 27 #include "media/cast/test/utility/standalone_cast_environment.h" |
28 #include "net/base/net_errors.h" | 28 #include "net/base/net_errors.h" |
29 #include "net/base/net_util.h" | 29 #include "net/base/net_util.h" |
30 #include "net/base/rand_callback.h" | 30 #include "net/base/rand_callback.h" |
31 #include "net/udp/udp_socket.h" | 31 #include "net/udp/udp_server_socket.h" |
32 #include "testing/gtest/include/gtest/gtest.h" | 32 #include "testing/gtest/include/gtest/gtest.h" |
33 | 33 |
34 using media::cast::test::GetFreeLocalPort; | 34 using media::cast::test::GetFreeLocalPort; |
35 | 35 |
36 namespace extensions { | 36 namespace extensions { |
37 | 37 |
38 class CastStreamingApiTest : public ExtensionApiTest { | 38 class CastStreamingApiTest : public ExtensionApiTest { |
39 public: | 39 public: |
40 void SetUpCommandLine(CommandLine* command_line) override { | 40 void SetUpCommandLine(CommandLine* command_line) override { |
41 ExtensionApiTest::SetUpCommandLine(command_line); | 41 ExtensionApiTest::SetUpCommandLine(command_line); |
(...skipping 292 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 // content and check whether it matches expectations. | 334 // content and check whether it matches expectations. |
335 // | 335 // |
336 // TODO(miu): Now that this test has been long-stable on Release build bots, it | 336 // TODO(miu): Now that this test has been long-stable on Release build bots, it |
337 // should be enabled for the Debug build bots. http://crbug.com/396413 | 337 // should be enabled for the Debug build bots. http://crbug.com/396413 |
338 #if defined(NDEBUG) | 338 #if defined(NDEBUG) |
339 #define MAYBE_EndToEnd EndToEnd | 339 #define MAYBE_EndToEnd EndToEnd |
340 #else | 340 #else |
341 #define MAYBE_EndToEnd DISABLED_EndToEnd | 341 #define MAYBE_EndToEnd DISABLED_EndToEnd |
342 #endif | 342 #endif |
343 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, MAYBE_EndToEnd) { | 343 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, MAYBE_EndToEnd) { |
344 scoped_ptr<net::UDPSocket> receive_socket( | 344 scoped_ptr<net::UDPServerSocket> receive_socket( |
345 new net::UDPSocket(net::DatagramSocket::DEFAULT_BIND, | 345 new net::UDPServerSocket(NULL, net::NetLog::Source())); |
346 net::RandIntCallback(), | |
347 NULL, | |
348 net::NetLog::Source())); | |
349 receive_socket->AllowAddressReuse(); | 346 receive_socket->AllowAddressReuse(); |
350 ASSERT_EQ(net::OK, receive_socket->Bind(GetFreeLocalPort())); | 347 ASSERT_EQ(net::OK, receive_socket->Listen(GetFreeLocalPort())); |
351 net::IPEndPoint receiver_end_point; | 348 net::IPEndPoint receiver_end_point; |
352 ASSERT_EQ(net::OK, receive_socket->GetLocalAddress(&receiver_end_point)); | 349 ASSERT_EQ(net::OK, receive_socket->GetLocalAddress(&receiver_end_point)); |
353 receive_socket.reset(); | 350 receive_socket.reset(); |
354 | 351 |
355 // Start the in-process receiver that examines audio/video for the expected | 352 // Start the in-process receiver that examines audio/video for the expected |
356 // test patterns. | 353 // test patterns. |
357 const scoped_refptr<media::cast::StandaloneCastEnvironment> cast_environment( | 354 const scoped_refptr<media::cast::StandaloneCastEnvironment> cast_environment( |
358 new media::cast::StandaloneCastEnvironment()); | 355 new media::cast::StandaloneCastEnvironment()); |
359 TestPatternReceiver* const receiver = | 356 TestPatternReceiver* const receiver = |
360 new TestPatternReceiver(cast_environment, receiver_end_point); | 357 new TestPatternReceiver(cast_environment, receiver_end_point); |
(...skipping 27 matching lines...) Expand all Loading... |
388 | 385 |
389 delete receiver; | 386 delete receiver; |
390 cast_environment->Shutdown(); | 387 cast_environment->Shutdown(); |
391 } | 388 } |
392 | 389 |
393 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, RtpStreamError) { | 390 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, RtpStreamError) { |
394 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "rtp_stream_error.html")); | 391 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "rtp_stream_error.html")); |
395 } | 392 } |
396 | 393 |
397 } // namespace extensions | 394 } // namespace extensions |
OLD | NEW |