| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 "media/base/filters.h" | 5 #include "media/base/filters.h" |
| 6 #include "media/base/mock_callback.h" | 6 #include "media/base/mock_callback.h" |
| 7 #include "media/base/mock_filter_host.h" | 7 #include "media/base/mock_filter_host.h" |
| 8 #include "media/base/mock_filters.h" | 8 #include "media/base/mock_filters.h" |
| 9 #include "net/base/net_errors.h" | 9 #include "net/base/net_errors.h" |
| 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 10 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| (...skipping 236 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 247 // Test redirect twice to the same domain. | 247 // Test redirect twice to the same domain. |
| 248 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); | 248 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); |
| 249 Redirect(kHttpRedirectToSameDomainUrl1); | 249 Redirect(kHttpRedirectToSameDomainUrl1); |
| 250 Redirect(kHttpRedirectToSameDomainUrl2); | 250 Redirect(kHttpRedirectToSameDomainUrl2); |
| 251 RequestSucceeded(false); | 251 RequestSucceeded(false); |
| 252 EXPECT_TRUE(data_source_->HasSingleOrigin()); | 252 EXPECT_TRUE(data_source_->HasSingleOrigin()); |
| 253 DestroyDataSource(); | 253 DestroyDataSource(); |
| 254 | 254 |
| 255 // Test redirect to a different domain. | 255 // Test redirect to a different domain. |
| 256 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); | 256 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); |
| 257 EXPECT_CALL(host_, SetError(media::PIPELINE_ERROR_NETWORK)); |
| 257 Redirect(kHttpRedirectToDifferentDomainUrl1); | 258 Redirect(kHttpRedirectToDifferentDomainUrl1); |
| 258 RequestSucceeded(false); | |
| 259 EXPECT_FALSE(data_source_->HasSingleOrigin()); | 259 EXPECT_FALSE(data_source_->HasSingleOrigin()); |
| 260 DestroyDataSource(); | 260 DestroyDataSource(); |
| 261 | 261 |
| 262 // Test redirect twice to a different domain. | 262 // Test redirect to the same domain and then to a different domain. |
| 263 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); | 263 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); |
| 264 Redirect(kHttpRedirectToSameDomainUrl1); |
| 265 EXPECT_CALL(host_, SetError(media::PIPELINE_ERROR_NETWORK)); |
| 264 Redirect(kHttpRedirectToDifferentDomainUrl1); | 266 Redirect(kHttpRedirectToDifferentDomainUrl1); |
| 265 Redirect(kHttpRedirectToDifferentDomainUrl2); | |
| 266 RequestSucceeded(false); | |
| 267 EXPECT_FALSE(data_source_->HasSingleOrigin()); | |
| 268 DestroyDataSource(); | |
| 269 | |
| 270 // Test to a different domain and then back to the same domain. | |
| 271 // NOTE: A different origin was encountered at least once so that | |
| 272 // makes HasSingleOrigin() become false. | |
| 273 InitializeDataSource(kHttpUrl, media::NewExpectedCallback()); | |
| 274 Redirect(kHttpRedirectToDifferentDomainUrl1); | |
| 275 Redirect(kHttpRedirectToSameDomainUrl1); | |
| 276 RequestSucceeded(false); | |
| 277 EXPECT_FALSE(data_source_->HasSingleOrigin()); | 267 EXPECT_FALSE(data_source_->HasSingleOrigin()); |
| 278 DestroyDataSource(); | 268 DestroyDataSource(); |
| 279 } | 269 } |
| 280 | 270 |
| 281 } // namespace webkit_glue | 271 } // namespace webkit_glue |
| OLD | NEW |