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_weburlloader.h" | 10 #include "content/test/mock_weburlloader.h" |
(...skipping 63 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
74 InSequence s; | 74 InSequence s; |
75 EXPECT_CALL(*url_loader_, cancel()); | 75 EXPECT_CALL(*url_loader_, cancel()); |
76 loader_.reset(); | 76 loader_.reset(); |
77 } | 77 } |
78 | 78 |
79 void Redirect(const char* url) { | 79 void Redirect(const char* url) { |
80 GURL redirect_url(url); | 80 GURL redirect_url(url); |
81 blink::WebURLRequest new_request(redirect_url); | 81 blink::WebURLRequest new_request(redirect_url); |
82 blink::WebURLResponse redirect_response(gurl_); | 82 blink::WebURLResponse redirect_response(gurl_); |
83 | 83 |
84 loader_->willFollowRedirect(url_loader_, new_request, redirect_response, 0); | 84 loader_->willFollowRedirect(url_loader_, new_request, redirect_response); |
85 | 85 |
86 base::RunLoop().RunUntilIdle(); | 86 base::RunLoop().RunUntilIdle(); |
87 } | 87 } |
88 | 88 |
89 void SendResponse( | 89 void SendResponse( |
90 int http_status, MediaInfoLoader::Status expected_status) { | 90 int http_status, MediaInfoLoader::Status expected_status) { |
91 EXPECT_CALL(*this, ReadyCallback(expected_status, _, _, _)); | 91 EXPECT_CALL(*this, ReadyCallback(expected_status, _, _, _)); |
92 EXPECT_CALL(*url_loader_, cancel()); | 92 EXPECT_CALL(*url_loader_, cancel()); |
93 | 93 |
94 WebURLResponse response(gurl_); | 94 WebURLResponse response(gurl_); |
(...skipping 100 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
195 } | 195 } |
196 | 196 |
197 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { | 197 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { |
198 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); | 198 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); |
199 Start(); | 199 Start(); |
200 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); | 200 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); |
201 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); | 201 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); |
202 } | 202 } |
203 | 203 |
204 } // namespace content | 204 } // namespace content |
OLD | NEW |