| Index: webkit/support/weburl_loader_mock.cc
|
| diff --git a/webkit/support/weburl_loader_mock.cc b/webkit/support/weburl_loader_mock.cc
|
| deleted file mode 100644
|
| index 06aff4da960d5828be825dfed1a002c3d855166d..0000000000000000000000000000000000000000
|
| --- a/webkit/support/weburl_loader_mock.cc
|
| +++ /dev/null
|
| @@ -1,98 +0,0 @@
|
| -// Copyright (c) 2011 The Chromium Authors. All rights reserved.
|
| -// Use of this source code is governed by a BSD-style license that can be
|
| -// found in the LICENSE file.
|
| -
|
| -#include "webkit/support/weburl_loader_mock.h"
|
| -
|
| -#include "base/logging.h"
|
| -#include "third_party/WebKit/public/platform/WebData.h"
|
| -#include "third_party/WebKit/public/platform/WebURLError.h"
|
| -#include "third_party/WebKit/public/platform/WebURLLoaderClient.h"
|
| -#include "webkit/support/weburl_loader_mock_factory.h"
|
| -
|
| -WebURLLoaderMock::WebURLLoaderMock(WebURLLoaderMockFactory* factory,
|
| - WebKit::WebURLLoader* default_loader)
|
| - : factory_(factory),
|
| - client_(NULL),
|
| - default_loader_(default_loader),
|
| - using_default_loader_(false),
|
| - is_deferred_(false) {
|
| -}
|
| -
|
| -WebURLLoaderMock::~WebURLLoaderMock() {
|
| -}
|
| -
|
| -void WebURLLoaderMock::ServeAsynchronousRequest(
|
| - const WebKit::WebURLResponse& response,
|
| - const WebKit::WebData& data,
|
| - const WebKit::WebURLError& error) {
|
| - DCHECK(!using_default_loader_);
|
| - if (!client_)
|
| - return;
|
| -
|
| - client_->didReceiveResponse(this, response);
|
| -
|
| - if (error.reason) {
|
| - client_->didFail(this, error);
|
| - return;
|
| - }
|
| - client_->didReceiveData(this, data.data(), data.size(), data.size());
|
| - client_->didFinishLoading(this, 0);
|
| -}
|
| -
|
| -WebKit::WebURLRequest WebURLLoaderMock::ServeRedirect(
|
| - const WebKit::WebURLResponse& redirectResponse) {
|
| - WebKit::WebURLRequest newRequest;
|
| - newRequest.initialize();
|
| - GURL redirectURL(redirectResponse.httpHeaderField("Location"));
|
| - newRequest.setURL(redirectURL);
|
| - client_->willSendRequest(this, newRequest, redirectResponse);
|
| - return newRequest;
|
| -}
|
| -
|
| -void WebURLLoaderMock::loadSynchronously(const WebKit::WebURLRequest& request,
|
| - WebKit::WebURLResponse& response,
|
| - WebKit::WebURLError& error,
|
| - WebKit::WebData& data) {
|
| - if (factory_->IsMockedURL(request.url())) {
|
| - factory_->LoadSynchronously(request, &response, &error, &data);
|
| - return;
|
| - }
|
| - DCHECK(static_cast<const GURL&>(request.url()).SchemeIs("data"))
|
| - << "loadSynchronously shouldn't be falling back: "
|
| - << request.url().spec().data();
|
| - using_default_loader_ = true;
|
| - default_loader_->loadSynchronously(request, response, error, data);
|
| -}
|
| -
|
| -void WebURLLoaderMock::loadAsynchronously(const WebKit::WebURLRequest& request,
|
| - WebKit::WebURLLoaderClient* client) {
|
| - if (factory_->IsMockedURL(request.url())) {
|
| - client_ = client;
|
| - factory_->LoadAsynchronouly(request, this);
|
| - return;
|
| - }
|
| - DCHECK(static_cast<const GURL&>(request.url()).SchemeIs("data"))
|
| - << "loadAsynchronously shouldn't be falling back: "
|
| - << request.url().spec().data();
|
| - using_default_loader_ = true;
|
| - default_loader_->loadAsynchronously(request, client);
|
| -}
|
| -
|
| -void WebURLLoaderMock::cancel() {
|
| - if (using_default_loader_) {
|
| - default_loader_->cancel();
|
| - return;
|
| - }
|
| - client_ = NULL;
|
| - factory_->CancelLoad(this);
|
| -}
|
| -
|
| -void WebURLLoaderMock::setDefersLoading(bool deferred) {
|
| - is_deferred_ = deferred;
|
| - if (using_default_loader_) {
|
| - default_loader_->setDefersLoading(deferred);
|
| - return;
|
| - }
|
| - NOTIMPLEMENTED();
|
| -}
|
|
|