| 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 <algorithm> | 5 #include <algorithm> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/format_macros.h" | 8 #include "base/format_macros.h" |
| 9 #include "base/stringprintf.h" | 9 #include "base/stringprintf.h" |
| 10 #include "media/base/media_log.h" |
| 10 #include "net/base/net_errors.h" | 11 #include "net/base/net_errors.h" |
| 11 #include "net/http/http_request_headers.h" | 12 #include "net/http/http_request_headers.h" |
| 12 #include "net/http/http_util.h" | 13 #include "net/http/http_util.h" |
| 13 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" | 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebFrame.h" |
| 14 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" | 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebString.h" |
| 15 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" | 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLError.h" |
| 16 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" | 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLRequest.h" |
| 17 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" | 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebURLResponse.h" |
| 18 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" | 19 #include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h" |
| 19 #include "webkit/glue/media/buffered_resource_loader.h" | 20 #include "webkit/glue/media/buffered_resource_loader.h" |
| (...skipping 72 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 view_->close(); | 93 view_->close(); |
| 93 } | 94 } |
| 94 | 95 |
| 95 void Initialize(const char* url, int first_position, int last_position) { | 96 void Initialize(const char* url, int first_position, int last_position) { |
| 96 gurl_ = GURL(url); | 97 gurl_ = GURL(url); |
| 97 first_position_ = first_position; | 98 first_position_ = first_position; |
| 98 last_position_ = last_position; | 99 last_position_ = last_position; |
| 99 | 100 |
| 100 url_loader_ = new NiceMock<MockWebURLLoader>(); | 101 url_loader_ = new NiceMock<MockWebURLLoader>(); |
| 101 loader_ = new BufferedResourceLoader(gurl_, | 102 loader_ = new BufferedResourceLoader(gurl_, |
| 102 first_position_, last_position_); | 103 first_position_, last_position_, |
| 104 new media::MediaLog()); |
| 103 loader_->SetURLLoaderForTest(url_loader_); | 105 loader_->SetURLLoaderForTest(url_loader_); |
| 104 } | 106 } |
| 105 | 107 |
| 106 void SetLoaderBuffer(size_t forward_capacity, size_t backward_capacity) { | 108 void SetLoaderBuffer(size_t forward_capacity, size_t backward_capacity) { |
| 107 loader_->buffer_.reset( | 109 loader_->buffer_.reset( |
| 108 new media::SeekableBuffer(backward_capacity, forward_capacity)); | 110 new media::SeekableBuffer(backward_capacity, forward_capacity)); |
| 109 } | 111 } |
| 110 | 112 |
| 111 void Start() { | 113 void Start() { |
| 112 InSequence s; | 114 InSequence s; |
| (...skipping 535 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 648 Start(); | 650 Start(); |
| 649 Redirect(kHttpRedirectToSameDomainUrl1); | 651 Redirect(kHttpRedirectToSameDomainUrl1); |
| 650 Redirect(kHttpRedirectToDifferentDomainUrl1); | 652 Redirect(kHttpRedirectToDifferentDomainUrl1); |
| 651 EXPECT_FALSE(loader_->HasSingleOrigin()); | 653 EXPECT_FALSE(loader_->HasSingleOrigin()); |
| 652 StopWhenLoad(); | 654 StopWhenLoad(); |
| 653 } | 655 } |
| 654 | 656 |
| 655 // TODO(hclam): add unit test for defer loading. | 657 // TODO(hclam): add unit test for defer loading. |
| 656 | 658 |
| 657 } // namespace webkit_glue | 659 } // namespace webkit_glue |
| OLD | NEW |