| 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 "content/renderer/media/android/media_info_loader.h" | 8 #include "content/renderer/media/android/media_info_loader.h" |
| 9 #include "content/test/mock_webframeclient.h" | 9 #include "content/test/mock_webframeclient.h" |
| 10 #include "content/test/mock_weburlloader.h" | 10 #include "content/test/mock_weburlloader.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; | 32 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; |
| 33 static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; | 33 static const char kHttpRedirectToDifferentDomainUrl1[] = "http://test2"; |
| 34 static const char kHttpDataUrl[] = "data:audio/wav;base64,UklGRhwMAABXQVZFZm10"; | 34 static const char kHttpDataUrl[] = "data:audio/wav;base64,UklGRhwMAABXQVZFZm10"; |
| 35 | 35 |
| 36 static const int kHttpOK = 200; | 36 static const int kHttpOK = 200; |
| 37 static const int kHttpNotFound = 404; | 37 static const int kHttpNotFound = 404; |
| 38 | 38 |
| 39 class MediaInfoLoaderTest : public testing::Test { | 39 class MediaInfoLoaderTest : public testing::Test { |
| 40 public: | 40 public: |
| 41 MediaInfoLoaderTest() | 41 MediaInfoLoaderTest() |
| 42 : view_(WebView::create(NULL)), | 42 : view_(WebView::create(nullptr, true)), |
| 43 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, | 43 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, |
| 44 &client_)) { | 44 &client_)) { |
| 45 view_->setMainFrame(frame_); | 45 view_->setMainFrame(frame_); |
| 46 } | 46 } |
| 47 | 47 |
| 48 virtual ~MediaInfoLoaderTest() { | 48 virtual ~MediaInfoLoaderTest() { |
| 49 view_->close(); | 49 view_->close(); |
| 50 frame_->close(); | 50 frame_->close(); |
| 51 } | 51 } |
| 52 | 52 |
| (...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 197 } | 197 } |
| 198 | 198 |
| 199 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { | 199 TEST_F(MediaInfoLoaderTest, CORSAccessCheckFailed) { |
| 200 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); | 200 Initialize(kHttpUrl, blink::WebMediaPlayer::CORSModeUseCredentials); |
| 201 Start(); | 201 Start(); |
| 202 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); | 202 SendResponse(kHttpNotFound, MediaInfoLoader::kFailed); |
| 203 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); | 203 EXPECT_FALSE(loader_->DidPassCORSAccessCheck()); |
| 204 } | 204 } |
| 205 | 205 |
| 206 } // namespace content | 206 } // namespace content |
| OLD | NEW |