| OLD | NEW |
| 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 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ | 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ |
| 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ | 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ |
| 7 | 7 |
| 8 #include "content/renderer/browser_plugin/browser_plugin.h" | 8 #include "content/renderer/browser_plugin/browser_plugin.h" |
| 9 #include "content/renderer/browser_plugin/mock_browser_plugin_texture_provider.h
" |
| 10 #include "testing/gmock/include/gmock/gmock.h" |
| 9 | 11 |
| 10 namespace content { | 12 namespace content { |
| 11 | 13 |
| 12 class MockBrowserPlugin : public BrowserPlugin { | 14 class MockBrowserPlugin : public BrowserPlugin { |
| 13 public: | 15 public: |
| 14 MockBrowserPlugin( | 16 MockBrowserPlugin( |
| 15 int id, | 17 int id, |
| 16 RenderViewImpl* render_view, | 18 RenderViewImpl* render_view, |
| 17 WebKit::WebFrame* frame, | 19 WebKit::WebFrame* frame, |
| 18 const WebKit::WebPluginParams& params); | 20 const WebKit::WebPluginParams& params); |
| 19 | 21 |
| 20 virtual ~MockBrowserPlugin(); | 22 virtual ~MockBrowserPlugin(); |
| 21 | 23 |
| 24 // Virtual overrides from BrowserPlugin |
| 25 MOCK_CONST_METHOD2(CreateTextureProvider, |
| 26 MockBrowserPluginTextureProvider*(int, int)); |
| 27 |
| 28 // Access to private members should be in the form of functions |
| 29 // to isolate tests from internal representation changes |
| 30 bool ignoringInput() { return ignore_input_; } |
| 31 bool hasTextureProvider() { return provider_; } |
| 32 int instance_id() { return instance_id_; } |
| 33 RenderViewImpl* render_view() { return render_view_; } |
| 34 |
| 22 // Allow poking at a few private members. | 35 // Allow poking at a few private members. |
| 23 using BrowserPlugin::guest_crashed_; | 36 using BrowserPlugin::guest_crashed_; |
| 24 using BrowserPlugin::resize_pending_; | 37 using BrowserPlugin::resize_pending_; |
| 38 using BrowserPlugin::width; |
| 39 using BrowserPlugin::height; |
| 25 }; | 40 }; |
| 26 | 41 |
| 27 } // namespace content | 42 } // namespace content |
| 28 | 43 |
| 29 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ | 44 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_MOCK_BROWSER_PLUGIN_H_ |
| OLD | NEW |