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 3 // found in the LICENSE file. 4 5 #ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_ 6 #define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_ 7 8 #include <string> 9 10 #include "base/memory/scoped_ptr.h" 11 #include "content/common/browser_plugin/browser_plugin_messages.h" 12 #include "content/public/renderer/content_renderer_client.h" 13 #include "content/public/test/render_view_test.h" 14 #include "content/renderer/browser_plugin/mock_browser_plugin_manager.h" 15 #include "content/renderer/render_view_impl.h" 16 #include "testing/gtest/include/gtest/gtest.h" 17 #include "third_party/WebKit/public/platform/WebSize.h" 18 #include "third_party/WebKit/public/web/WebView.h" 19 20 class RenderThreadImpl; 21 22 namespace content { 23 24 class MockBrowserPlugin; 25 class TestContentRendererClient; 26 27 class BrowserPluginTest : public RenderViewTest { 28 public: 29 BrowserPluginTest(); 30 virtual ~BrowserPluginTest(); 31 32 virtual void SetUp() OVERRIDE; 33 virtual void TearDown() OVERRIDE; 34 MockBrowserPluginManager* browser_plugin_manager() const { 35 return static_cast<MockBrowserPluginManager*>( 36 static_cast<RenderViewImpl*>(view_)->GetBrowserPluginManager()); 37 } 38 std::string ExecuteScriptAndReturnString(const std::string& script); 39 int ExecuteScriptAndReturnInt(const std::string& script); 40 bool ExecuteScriptAndReturnBool(const std::string& script, bool* result); 41 // Returns NULL if there is no plugin. 42 MockBrowserPlugin* GetCurrentPlugin(); 43 // Returns NULL if there is no plugin. 44 MockBrowserPlugin* GetCurrentPluginWithAttachParams( 45 BrowserPluginHostMsg_Attach_Params* params); 46 private: 47 scoped_ptr<TestContentRendererClient> test_content_renderer_client_; 48 }; 49 50 } // namespace content 51 52 #endif // CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_ 53 54