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 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
64 class WebFrame; | 64 class WebFrame; |
65 } | 65 } |
66 | 66 |
67 namespace safe_browsing { | 67 namespace safe_browsing { |
68 | 68 |
69 class RenderViewFakeResourcesTest : public ::testing::Test, | 69 class RenderViewFakeResourcesTest : public ::testing::Test, |
70 public IPC::Channel::Listener, | 70 public IPC::Channel::Listener, |
71 public RenderViewVisitor { | 71 public RenderViewVisitor { |
72 public: | 72 public: |
73 // IPC::Channel::Listener implementation. | 73 // IPC::Channel::Listener implementation. |
74 virtual void OnMessageReceived(const IPC::Message& message); | 74 virtual bool OnMessageReceived(const IPC::Message& message); |
75 | 75 |
76 // RenderViewVisitor implementation. | 76 // RenderViewVisitor implementation. |
77 virtual bool Visit(RenderView* render_view); | 77 virtual bool Visit(RenderView* render_view); |
78 | 78 |
79 protected: | 79 protected: |
80 RenderViewFakeResourcesTest(); | 80 RenderViewFakeResourcesTest(); |
81 virtual ~RenderViewFakeResourcesTest(); | 81 virtual ~RenderViewFakeResourcesTest(); |
82 | 82 |
83 // Call the base class SetUp and TearDown methods as part of your | 83 // Call the base class SetUp and TearDown methods as part of your |
84 // test fixture's SetUp / TearDown. | 84 // test fixture's SetUp / TearDown. |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
131 // Any urls not in this map are served a 404 error. | 131 // Any urls not in this map are served a 404 error. |
132 std::map<std::string, std::string> responses_; | 132 std::map<std::string, std::string> responses_; |
133 | 133 |
134 private: | 134 private: |
135 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); | 135 DISALLOW_COPY_AND_ASSIGN(RenderViewFakeResourcesTest); |
136 }; | 136 }; |
137 | 137 |
138 } // namespace safe_browsing | 138 } // namespace safe_browsing |
139 | 139 |
140 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ | 140 #endif // CHROME_RENDERER_SAFE_BROWSING_RENDER_VIEW_FAKE_RESOURCES_TEST_H_ |
OLD | NEW |