Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(734)

Side by Side Diff: webkit/support/weburl_loader_mock.h

Issue 2749020: Adding a way to mock WebURLLoader in webkit_support.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « webkit/support/webkit_support.gypi ('k') | webkit/support/weburl_loader_mock.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_H_
6 #define WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_H_
7
8 #include "base/logging.h"
9 #include "base/scoped_ptr.h"
10 #include "third_party/WebKit/WebKit/chromium/public/WebURLLoader.h"
11
12 namespace WebKit {
13 class WebData;
14 struct WebURLError;
15 class WebURLLoaderClient;
16 class WebURLRequest;
17 class WebURLResponse;
18 }
19
20 class WebURLLoaderMockFactory;
21
22 // A simple class for mocking WebURLLoader.
23 // If the WebURLLoaderMockFactory it is associated with has been configured to
24 // mock the request it gets, it serves the mocked resource. Otherwise it just
25 // forwards it to the default loader.
26 class WebURLLoaderMock : public WebKit::WebURLLoader {
27 public:
28 // This object becomes the owner of |default_loader|.
29 WebURLLoaderMock(WebURLLoaderMockFactory* factory,
30 WebKit::WebURLLoader* default_loader);
31 virtual ~WebURLLoaderMock();
32
33 // Simulates the asynchronous request being served.
34 void ServeAsynchronousRequest(const WebKit::WebURLResponse& response,
35 const WebKit::WebData& data,
36 const WebKit::WebURLError& error);
37
38 // WebURLLoader methods:
39 virtual void loadSynchronously(const WebKit::WebURLRequest& request,
40 WebKit::WebURLResponse& response,
41 WebKit::WebURLError& error,
42 WebKit::WebData& data);
43 virtual void loadAsynchronously(const WebKit::WebURLRequest& request,
44 WebKit::WebURLLoaderClient* client);
45 virtual void cancel();
46 virtual void setDefersLoading(bool defer);
47
48 private:
49 WebURLLoaderMockFactory* factory_;
50 WebKit::WebURLLoaderClient* client_;
51 scoped_ptr<WebKit::WebURLLoader> default_loader_;
52 bool using_default_loader_;
53
54 DISALLOW_COPY_AND_ASSIGN(WebURLLoaderMock);
55 };
56
57 #endif // WEBKIT_SUPPORT_WEBURL_LOADER_MOCK_H_
OLDNEW
« no previous file with comments | « webkit/support/webkit_support.gypi ('k') | webkit/support/weburl_loader_mock.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698