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_webassociatedurlloader.h" | 10 #include "content/test/mock_webassociatedurlloader.h" |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
59 | 59 |
60 // |test_loader_| will be used when Start() is called. | 60 // |test_loader_| will be used when Start() is called. |
61 url_loader_ = new NiceMock<MockWebAssociatedURLLoader>(); | 61 url_loader_ = new NiceMock<MockWebAssociatedURLLoader>(); |
62 loader_->test_loader_ = | 62 loader_->test_loader_ = |
63 std::unique_ptr<blink::WebAssociatedURLLoader>(url_loader_); | 63 std::unique_ptr<blink::WebAssociatedURLLoader>(url_loader_); |
64 } | 64 } |
65 | 65 |
66 void Start() { | 66 void Start() { |
67 InSequence s; | 67 InSequence s; |
68 EXPECT_CALL(*url_loader_, LoadAsynchronously(_, _)); | 68 EXPECT_CALL(*url_loader_, LoadAsynchronously(_, _)); |
69 loader_->Start(view_->MainFrame()); | 69 loader_->Start(view_->MainFrame()->ToWebLocalFrame()); |
70 } | 70 } |
71 | 71 |
72 void Stop() { | 72 void Stop() { |
73 InSequence s; | 73 InSequence s; |
74 EXPECT_CALL(*url_loader_, Cancel()); | 74 EXPECT_CALL(*url_loader_, Cancel()); |
75 loader_.reset(); | 75 loader_.reset(); |
76 } | 76 } |
77 | 77 |
78 void Redirect(const char* url) { | 78 void Redirect(const char* url) { |
79 GURL redirect_url(url); | 79 GURL redirect_url(url); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
194 } | 194 } |
195 | 195 |
196 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { | 196 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { |
197 Initialize(kHttpUrl, blink::WebMediaPlayer::kCORSModeUseCredentials); | 197 Initialize(kHttpUrl, blink::WebMediaPlayer::kCORSModeUseCredentials); |
198 Start(); | 198 Start(); |
199 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); | 199 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); |
200 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); | 200 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); |
201 } | 201 } |
202 | 202 |
203 } // namespace content | 203 } // namespace content |
OLD | NEW |