| 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 23 matching lines...) Expand all Loading... |
| 34 static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; | 34 static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; |
| 35 static const char kHttpDataUrl[] = "data:audio/wav;base64,UklGRhwMAABXQVZFZm10"; | 35 static const char kHttpDataUrl[] = "data:audio/wav;base64,UklGRhwMAABXQVZFZm10"; |
| 36 | 36 |
| 37 static const int kHttpOK = 200; | 37 static const int kHttpOK = 200; |
| 38 static const int kHttpNotFound = 404; | 38 static const int kHttpNotFound = 404; |
| 39 | 39 |
| 40 class MediaInfoLoaderTest : public testing::Test { | 40 class MediaInfoLoaderTest : public testing::Test { |
| 41 public: | 41 public: |
| 42 MediaInfoLoaderTest() | 42 MediaInfoLoaderTest() |
| 43 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)) { | 43 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)) { |
| 44 view_->setMainFrame( | 44 view_->setMainFrame(WebLocalFrame::create(blink::WebTreeScopeType::Document, |
| 45 WebLocalFrame::create(blink::WebTreeScopeType::Document, &client_)); | 45 &client_, nullptr, nullptr)); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual ~MediaInfoLoaderTest() { | 48 virtual ~MediaInfoLoaderTest() { |
| 49 view_->close(); | 49 view_->close(); |
| 50 } | 50 } |
| 51 | 51 |
| 52 void Initialize( | 52 void Initialize( |
| 53 const char* url, | 53 const char* url, |
| 54 blink::WebMediaPlayer::CORSMode cors_mode) { | 54 blink::WebMediaPlayer::CORSMode cors_mode) { |
| 55 gurl_ = GURL(url); | 55 gurl_ = GURL(url); |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 196 } | 196 } |
| 197 | 197 |
| 198 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { | 198 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { |
| 199 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); | 199 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); |
| 200 Start(); | 200 Start(); |
| 201 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); | 201 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); |
| 202 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); | 202 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); |
| 203 } | 203 } |
| 204 | 204 |
| 205 } // namespace content | 205 } // namespace content |
| OLD | NEW |