| 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 "base/bind.h" | 5 #include "base/bind.h" |
| 6 #include "base/macros.h" | 6 #include "base/macros.h" |
| 7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/renderer/media/android/media_info_loader.h" | 9 #include "content/renderer/media/android/media_info_loader.h" |
| 10 #include "content/test/mock_webframeclient.h" | 10 #include "content/test/mock_webframeclient.h" |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 76 InSequence s; | 76 InSequence s; |
| 77 EXPECT_CALL(*url_loader_, cancel()); | 77 EXPECT_CALL(*url_loader_, cancel()); |
| 78 loader_.reset(); | 78 loader_.reset(); |
| 79 } | 79 } |
| 80 | 80 |
| 81 void Redirect(const char* url) { | 81 void Redirect(const char* url) { |
| 82 GURL redirect_url(url); | 82 GURL redirect_url(url); |
| 83 blink::WebURLRequest new_request(redirect_url); | 83 blink::WebURLRequest new_request(redirect_url); |
| 84 blink::WebURLResponse redirect_response(gurl_); | 84 blink::WebURLResponse redirect_response(gurl_); |
| 85 | 85 |
| 86 loader_->willFollowRedirect(url_loader_, new_request, redirect_response); | 86 loader_->willFollowRedirect(url_loader_, new_request, redirect_response, 0); |
| 87 | 87 |
| 88 base::RunLoop().RunUntilIdle(); | 88 base::RunLoop().RunUntilIdle(); |
| 89 } | 89 } |
| 90 | 90 |
| 91 void SendResponse( | 91 void SendResponse( |
| 92 int http_status, MediaInfoLoader::Status expected_status) { | 92 int http_status, MediaInfoLoader::Status expected_status) { |
| 93 EXPECT_CALL(*this, ReadyCallback(expected_status, _, _, _)); | 93 EXPECT_CALL(*this, ReadyCallback(expected_status, _, _, _)); |
| 94 EXPECT_CALL(*url_loader_, cancel()); | 94 EXPECT_CALL(*url_loader_, cancel()); |
| 95 | 95 |
| 96 WebURLResponse response(gurl_); | 96 WebURLResponse response(gurl_); |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 198 } | 198 } |
| 199 | 199 |
| 200 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { | 200 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { |
| 201 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); | 201 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); |
| 202 Start(); | 202 Start(); |
| 203 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); | 203 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); |
| 204 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); | 204 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); |
| 205 } | 205 } |
| 206 | 206 |
| 207 } // namespace content | 207 } // namespace content |
| OLD | NEW |