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

Side by Side Diff: content/public/test/render_view_fake_resources_test.h

Issue 14335017: content: Use base::MessageLoop. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: rebase Created 7 years, 7 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 | « content/public/test/mock_render_thread.h ('k') | content/public/test/render_view_test.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 // RenderViewFakeResourcesTest can be used as a base class for tests that need 5 // RenderViewFakeResourcesTest can be used as a base class for tests that need
6 // to simulate loading network resources (such as http: urls) into a 6 // to simulate loading network resources (such as http: urls) into a
7 // RenderView. It does this by handling the relevant IPC messages that the 7 // RenderView. It does this by handling the relevant IPC messages that the
8 // renderer would normally send to the browser, and responding with static 8 // renderer would normally send to the browser, and responding with static
9 // content from an internal map. A request for a url that is not in the map 9 // content from an internal map. A request for a url that is not in the map
10 // will return a 404. Currently, content is always returned as text/html, and 10 // will return a 404. Currently, content is always returned as text/html, and
(...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after
120 // and the supplied content, otherwise we send it a 404 error. 120 // and the supplied content, otherwise we send it a 404 error.
121 void OnRequestResource(const IPC::Message& message, 121 void OnRequestResource(const IPC::Message& message,
122 int request_id, 122 int request_id,
123 const ResourceHostMsg_Request& request_data); 123 const ResourceHostMsg_Request& request_data);
124 124
125 // Notification that the render view we've created is ready to use. 125 // Notification that the render view we've created is ready to use.
126 void OnRenderViewReady(); 126 void OnRenderViewReady();
127 127
128 static const int32 kViewId; // arbitrary id for our testing view 128 static const int32 kViewId; // arbitrary id for our testing view
129 129
130 MessageLoopForIO message_loop_; 130 base::MessageLoopForIO message_loop_;
131 ContentRendererClient content_renderer_client_; 131 ContentRendererClient content_renderer_client_;
132 // channel that the renderer uses to talk to the browser. 132 // channel that the renderer uses to talk to the browser.
133 // For this test, we will handle the browser end of the channel. 133 // For this test, we will handle the browser end of the channel.
134 scoped_ptr<IPC::Channel> channel_; 134 scoped_ptr<IPC::Channel> channel_;
135 RenderThreadImpl* render_thread_; // owned by mock_process_ 135 RenderThreadImpl* render_thread_; // owned by mock_process_
136 scoped_ptr<MockRenderProcess> mock_process_; 136 scoped_ptr<MockRenderProcess> mock_process_;
137 RenderView* view_; // not owned, deletes itself on close 137 RenderView* view_; // not owned, deletes itself on close
138 138
139 // Map of url -> response body for network requests from the renderer. 139 // Map of url -> response body for network requests from the renderer.
140 // Any urls not in this map are served a 404 error. 140 // Any urls not in this map are served a 404 error.
141 std::map<std::string, std::string> responses_; 141 std::map<std::string, std::string> responses_;
142 142
143 private: 143 private:
144 // A helper for GoBack and GoForward. 144 // A helper for GoBack and GoForward.
145 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item); 145 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item);
146 146
147 // The previous state for whether sandbox support was enabled in 147 // The previous state for whether sandbox support was enabled in
148 // RenderViewWebKitPlatformSupportImpl. 148 // RenderViewWebKitPlatformSupportImpl.
149 bool sandbox_was_enabled_; 149 bool sandbox_was_enabled_;
150 150
151 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); 151 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest);
152 }; 152 };
153 153
154 } // namespace content 154 } // namespace content
155 155
156 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ 156 #endif // CONTENT_PUBLIC_TEST_RENDER_VIEW_FAKE_RESOURCES_TEST_H_
OLDNEW
« no previous file with comments | « content/public/test/mock_render_thread.h ('k') | content/public/test/render_view_test.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698