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