OLD | NEW |
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 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 | 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 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
87 | 87 |
88 // Loads |url| into the RenderView, waiting for the load to finish. | 88 // Loads |url| into the RenderView, waiting for the load to finish. |
89 // Before loading the url, add any content that you want to return | 89 // Before loading the url, add any content that you want to return |
90 // to responses_. | 90 // to responses_. |
91 void LoadURL(const std::string& url); | 91 void LoadURL(const std::string& url); |
92 | 92 |
93 // Same as LoadURL, but sends a POST request. Note that POST data is | 93 // Same as LoadURL, but sends a POST request. Note that POST data is |
94 // not supported. | 94 // not supported. |
95 void LoadURLWithPost(const std::string& url); | 95 void LoadURLWithPost(const std::string& url); |
96 | 96 |
| 97 // Navigates the main frame back in session history. |
| 98 void GoBack(); |
| 99 |
97 // Returns the main WebFrame for our RenderView. | 100 // Returns the main WebFrame for our RenderView. |
98 WebKit::WebFrame* GetMainFrame(); | 101 WebKit::WebFrame* GetMainFrame(); |
99 | 102 |
100 // IPC message handlers below | 103 // IPC message handlers below |
101 | 104 |
102 // Notification that page load has finished. Exit the message loop | 105 // Notification that page load has finished. Exit the message loop |
103 // so that the test can continue. | 106 // so that the test can continue. |
104 void OnDidStopLoading(); | 107 void OnDidStopLoading(); |
105 | 108 |
106 // Notification that the renderer wants to load a resource. | 109 // Notification that the renderer wants to load a resource. |
(...skipping 24 matching lines...) Expand all Loading... |
131 // Any urls not in this map are served a 404 error. | 134 // Any urls not in this map are served a 404 error. |
132 std::map<std::string, std::string> responses_; | 135 std::map<std::string, std::string> responses_; |
133 | 136 |
134 private: | 137 private: |
135 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); | 138 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); |
136 }; | 139 }; |
137 | 140 |
138 } // namespace safe_browsing | 141 } // namespace safe_browsing |
139 | 142 |
140 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ | 143 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ |
OLD | NEW |