| 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 // 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 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 #ifndef CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ | 42 #ifndef CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ |
| 43 #define CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ | 43 #define CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ |
| 44 | 44 |
| 45 #include <map> | 45 #include <map> |
| 46 #include <string> | 46 #include <string> |
| 47 | 47 |
| 48 #include "base/memory/scoped_ptr.h" | 48 #include "base/memory/scoped_ptr.h" |
| 49 #include "base/message_loop.h" | 49 #include "base/message_loop.h" |
| 50 #include "chrome/renderer/chrome_content_renderer_client.h" | 50 #include "chrome/renderer/chrome_content_renderer_client.h" |
| 51 #include "content/renderer/render_view_visitor.h" | 51 #include "content/public/renderer/render_view_visitor.h" |
| 52 #include "ipc/ipc_channel.h" | 52 #include "ipc/ipc_channel.h" |
| 53 #include "testing/gtest/include/gtest/gtest.h" | 53 #include "testing/gtest/include/gtest/gtest.h" |
| 54 | 54 |
| 55 class CommandLine; | 55 class CommandLine; |
| 56 class MockRenderProcess; | 56 class MockRenderProcess; |
| 57 class RendererMainPlatformDelegate; | 57 class RendererMainPlatformDelegate; |
| 58 class RenderThread; | 58 class RenderThread; |
| 59 class RenderView; | 59 class RenderView; |
| 60 class SandboxInitWrapper; | 60 class SandboxInitWrapper; |
| 61 struct MainFunctionParams; | 61 struct MainFunctionParams; |
| 62 struct ResourceHostMsg_Request; | 62 struct ResourceHostMsg_Request; |
| 63 | 63 |
| 64 namespace WebKit { | 64 namespace WebKit { |
| 65 class WebFrame; | 65 class WebFrame; |
| 66 class WebHistoryItem; | 66 class WebHistoryItem; |
| 67 } | 67 } |
| 68 | 68 |
| 69 namespace safe_browsing { | 69 namespace safe_browsing { |
| 70 | 70 |
| 71 class RenderViewFakeResourcesTest : public ::testing::Test, | 71 class RenderViewFakeResourcesTest : public ::testing::Test, |
| 72 public IPC::Channel::Listener, | 72 public IPC::Channel::Listener, |
| 73 public RenderViewVisitor { | 73 public content::RenderViewVisitor { |
| 74 public: | 74 public: |
| 75 // IPC::Channel::Listener implementation. | 75 // IPC::Channel::Listener implementation. |
| 76 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; | 76 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE; |
| 77 | 77 |
| 78 // RenderViewVisitor implementation. | 78 // RenderViewVisitor implementation. |
| 79 virtual bool Visit(RenderView* render_view) OVERRIDE; | 79 virtual bool Visit(RenderView* render_view) OVERRIDE; |
| 80 | 80 |
| 81 protected: | 81 protected: |
| 82 RenderViewFakeResourcesTest(); | 82 RenderViewFakeResourcesTest(); |
| 83 virtual ~RenderViewFakeResourcesTest(); | 83 virtual ~RenderViewFakeResourcesTest(); |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 146 private: | 146 private: |
| 147 // A helper for GoBack and GoForward. | 147 // A helper for GoBack and GoForward. |
| 148 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item); | 148 void GoToOffset(int offset, const WebKit::WebHistoryItem& history_item); |
| 149 | 149 |
| 150 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); | 150 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); |
| 151 }; | 151 }; |
| 152 | 152 |
| 153 } // namespace safe_browsing | 153 } // namespace safe_browsing |
| 154 | 154 |
| 155 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ | 155 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ |
| OLD | NEW |