| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "chrome/test/media_router/media_router_e2e_browsertest.h" | 5 #include "chrome/test/media_router/media_router_e2e_browsertest.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/stl_util.h" | 9 #include "base/stl_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 95 const auto it = sink_map.find(receiver()); | 95 const auto it = sink_map.find(receiver()); |
| 96 const MediaSink& sink = it->second; | 96 const MediaSink& sink = it->second; |
| 97 | 97 |
| 98 // The callback will set route_id_ when invoked. | 98 // The callback will set route_id_ when invoked. |
| 99 std::vector<MediaRouteResponseCallback> route_response_callbacks; | 99 std::vector<MediaRouteResponseCallback> route_response_callbacks; |
| 100 route_response_callbacks.push_back( | 100 route_response_callbacks.push_back( |
| 101 base::Bind(&MediaRouterE2EBrowserTest::OnRouteResponseReceived, | 101 base::Bind(&MediaRouterE2EBrowserTest::OnRouteResponseReceived, |
| 102 base::Unretained(this))); | 102 base::Unretained(this))); |
| 103 media_router_->CreateRoute(source.id(), sink.id(), origin, web_contents, | 103 media_router_->CreateRoute(source.id(), sink.id(), origin, web_contents, |
| 104 route_response_callbacks, base::TimeDelta(), | 104 route_response_callbacks, base::TimeDelta(), |
| 105 is_off_the_record()); | 105 is_incognito()); |
| 106 | 106 |
| 107 // Wait for the route request to be fulfilled (and route to be started). | 107 // Wait for the route request to be fulfilled (and route to be started). |
| 108 ASSERT_TRUE(ConditionalWait( | 108 ASSERT_TRUE(ConditionalWait( |
| 109 base::TimeDelta::FromSeconds(30), base::TimeDelta::FromSeconds(1), | 109 base::TimeDelta::FromSeconds(30), base::TimeDelta::FromSeconds(1), |
| 110 base::Bind(&MediaRouterE2EBrowserTest::IsRouteCreated, | 110 base::Bind(&MediaRouterE2EBrowserTest::IsRouteCreated, |
| 111 base::Unretained(this)))); | 111 base::Unretained(this)))); |
| 112 } | 112 } |
| 113 | 113 |
| 114 void MediaRouterE2EBrowserTest::StopMediaRoute() { | 114 void MediaRouterE2EBrowserTest::StopMediaRoute() { |
| 115 ASSERT_FALSE(route_id_.empty()); | 115 ASSERT_FALSE(route_id_.empty()); |
| (...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 CreateMediaRoute(MediaSourceForPresentationUrl(kCastAppPresentationUrl), | 161 CreateMediaRoute(MediaSourceForPresentationUrl(kCastAppPresentationUrl), |
| 162 GURL(kOriginUrl), nullptr); | 162 GURL(kOriginUrl), nullptr); |
| 163 Wait(base::TimeDelta::FromSeconds(30)); | 163 Wait(base::TimeDelta::FromSeconds(30)); |
| 164 | 164 |
| 165 // Wait for 10 seconds to make sure route has been stopped. | 165 // Wait for 10 seconds to make sure route has been stopped. |
| 166 StopMediaRoute(); | 166 StopMediaRoute(); |
| 167 Wait(base::TimeDelta::FromSeconds(10)); | 167 Wait(base::TimeDelta::FromSeconds(10)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace media_router | 170 } // namespace media_router |
| OLD | NEW |