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 22 matching lines...) Expand all Loading... |
33 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; | 33 static const char kHttpRedirectToSameDomainUrl2[] = "http://test/ing2"; |
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(NULL)), | 43 : view_(WebView::create(nullptr, blink::WebPageVisibilityStateVisible)), |
44 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, | 44 frame_(WebLocalFrame::create(blink::WebTreeScopeType::Document, |
45 &client_)) { | 45 &client_)) { |
46 view_->setMainFrame(frame_); | 46 view_->setMainFrame(frame_); |
47 } | 47 } |
48 | 48 |
49 virtual ~MediaInfoLoaderTest() { | 49 virtual ~MediaInfoLoaderTest() { |
50 view_->close(); | 50 view_->close(); |
51 frame_->close(); | 51 frame_->close(); |
52 } | 52 } |
53 | 53 |
(...skipping 144 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 |