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/bind_to_current_loop.h" |
9 #include "base/callback_helpers.h" | 10 #include "base/callback_helpers.h" |
10 #include "base/command_line.h" | 11 #include "base/command_line.h" |
11 #include "base/memory/scoped_ptr.h" | 12 #include "base/memory/scoped_ptr.h" |
12 #include "base/run_loop.h" | 13 #include "base/run_loop.h" |
13 #include "base/strings/string_number_conversions.h" | 14 #include "base/strings/string_number_conversions.h" |
14 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
15 #include "chrome/browser/extensions/extension_apitest.h" | 16 #include "chrome/browser/extensions/extension_apitest.h" |
16 #include "chrome/common/chrome_switches.h" | 17 #include "chrome/common/chrome_switches.h" |
17 #include "content/public/common/content_switches.h" | 18 #include "content/public/common/content_switches.h" |
18 #include "extensions/common/switches.h" | 19 #include "extensions/common/switches.h" |
19 #include "media/base/bind_to_current_loop.h" | |
20 #include "media/base/video_frame.h" | 20 #include "media/base/video_frame.h" |
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" |
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
121 } | 121 } |
122 | 122 |
123 // Blocks the caller until all expected tones and colors have been observed. | 123 // Blocks the caller until all expected tones and colors have been observed. |
124 void WaitForExpectedTonesAndColors() { | 124 void WaitForExpectedTonesAndColors() { |
125 base::RunLoop run_loop; | 125 base::RunLoop run_loop; |
126 cast_env()->PostTask( | 126 cast_env()->PostTask( |
127 media::cast::CastEnvironment::MAIN, | 127 media::cast::CastEnvironment::MAIN, |
128 FROM_HERE, | 128 FROM_HERE, |
129 base::Bind(&TestPatternReceiver::NotifyOnceObservedAllTonesAndColors, | 129 base::Bind(&TestPatternReceiver::NotifyOnceObservedAllTonesAndColors, |
130 base::Unretained(this), | 130 base::Unretained(this), |
131 media::BindToCurrentLoop(run_loop.QuitClosure()))); | 131 base::BindToCurrentLoop(run_loop.QuitClosure()))); |
132 run_loop.Run(); | 132 run_loop.Run(); |
133 } | 133 } |
134 | 134 |
135 private: | 135 private: |
136 void NotifyOnceObservedAllTonesAndColors(const base::Closure& done_callback) { | 136 void NotifyOnceObservedAllTonesAndColors(const base::Closure& done_callback) { |
137 DCHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); | 137 DCHECK(cast_env()->CurrentlyOn(media::cast::CastEnvironment::MAIN)); |
138 done_callback_ = done_callback; | 138 done_callback_ = done_callback; |
139 MaybeRunDoneCallback(); | 139 MaybeRunDoneCallback(); |
140 } | 140 } |
141 | 141 |
(...skipping 243 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
385 | 385 |
386 delete receiver; | 386 delete receiver; |
387 cast_environment->Shutdown(); | 387 cast_environment->Shutdown(); |
388 } | 388 } |
389 | 389 |
390 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, RtpStreamError) { | 390 IN_PROC_BROWSER_TEST_F(CastStreamingApiTestWithPixelOutput, RtpStreamError) { |
391 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "rtp_stream_error.html")); | 391 ASSERT_TRUE(RunExtensionSubtest("cast_streaming", "rtp_stream_error.html")); |
392 } | 392 } |
393 | 393 |
394 } // namespace extensions | 394 } // namespace extensions |
OLD | NEW |