| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "chrome/browser/media/router/create_presentation_connection_request.h" | 6 #include "chrome/browser/media/router/create_presentation_connection_request.h" |
| 7 #include "chrome/browser/media/router/media_source_helper.h" | 7 #include "chrome/browser/media/router/media_source_helper.h" |
| 8 #include "content/public/browser/presentation_service_delegate.h" | 8 #include "content/public/browser/presentation_service_delegate.h" |
| 9 #include "testing/gtest/include/gtest/gtest.h" | 9 #include "testing/gtest/include/gtest/gtest.h" |
| 10 | 10 |
| (...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 59 content::PresentationError error(content::PRESENTATION_ERROR_UNKNOWN, | 59 content::PresentationError error(content::PRESENTATION_ERROR_UNKNOWN, |
| 60 "Unknown error."); | 60 "Unknown error."); |
| 61 CreatePresentationConnectionRequest request( | 61 CreatePresentationConnectionRequest request( |
| 62 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), | 62 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), |
| 63 base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, | 63 base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, |
| 64 base::Unretained(this)), | 64 base::Unretained(this)), |
| 65 base::Bind(&CreatePresentationConnectionRequestTest::OnError, | 65 base::Bind(&CreatePresentationConnectionRequestTest::OnError, |
| 66 base::Unretained(this), error)); | 66 base::Unretained(this), error)); |
| 67 | 67 |
| 68 PresentationRequest presentation_request(render_frame_host_id_, | 68 PresentationRequest presentation_request(render_frame_host_id_, |
| 69 kPresentationUrl, GURL(kFrameUrl)); | 69 {kPresentationUrl}, GURL(kFrameUrl)); |
| 70 EXPECT_TRUE(request.presentation_request().Equals(presentation_request)); | 70 EXPECT_TRUE(request.presentation_request().Equals(presentation_request)); |
| 71 // Since we didn't explicitly call Invoke*, the error callback will be | 71 // Since we didn't explicitly call Invoke*, the error callback will be |
| 72 // invoked when |request| is destroyed. | 72 // invoked when |request| is destroyed. |
| 73 } | 73 } |
| 74 | 74 |
| 75 TEST_F(CreatePresentationConnectionRequestTest, SuccessCallback) { | 75 TEST_F(CreatePresentationConnectionRequestTest, SuccessCallback) { |
| 76 content::PresentationSessionInfo session_info(kPresentationUrl, | 76 content::PresentationSessionInfo session_info(kPresentationUrl, |
| 77 kPresentationId); | 77 kPresentationId); |
| 78 CreatePresentationConnectionRequest request( | 78 CreatePresentationConnectionRequest request( |
| 79 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), | 79 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), |
| (...skipping 13 matching lines...) Expand all Loading... |
| 93 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), | 93 render_frame_host_id_, kPresentationUrl, GURL(kFrameUrl), |
| 94 base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, | 94 base::Bind(&CreatePresentationConnectionRequestTest::FailOnSuccess, |
| 95 base::Unretained(this)), | 95 base::Unretained(this)), |
| 96 base::Bind(&CreatePresentationConnectionRequestTest::OnError, | 96 base::Bind(&CreatePresentationConnectionRequestTest::OnError, |
| 97 base::Unretained(this), error)); | 97 base::Unretained(this), error)); |
| 98 request.InvokeErrorCallback(error); | 98 request.InvokeErrorCallback(error); |
| 99 EXPECT_TRUE(cb_invoked_); | 99 EXPECT_TRUE(cb_invoked_); |
| 100 } | 100 } |
| 101 | 101 |
| 102 } // namespace media_router | 102 } // namespace media_router |
| OLD | NEW |