summaryrefslogtreecommitdiffstats
path: root/content/renderer/browser_plugin/browser_plugin_browsertest.h
blob: 43ad0f85a8302c6d85b63a2416c269928f7ba4ce (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
// Copyright (c) 2012 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_
#define CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_

#include <string>

#include "base/memory/scoped_ptr.h"
#include "content/common/browser_plugin/browser_plugin_messages.h"
#include "content/public/renderer/content_renderer_client.h"
#include "content/public/test/render_view_test.h"
#include "content/renderer/browser_plugin/mock_browser_plugin_manager.h"
#include "content/renderer/render_view_impl.h"
#include "testing/gtest/include/gtest/gtest.h"
#include "third_party/WebKit/public/platform/WebSize.h"
#include "third_party/WebKit/Source/WebKit/chromium/public/WebView.h"

class RenderThreadImpl;

namespace content {

class MockBrowserPlugin;
class TestContentRendererClient;

class BrowserPluginTest : public RenderViewTest {
 public:
  BrowserPluginTest();
  virtual ~BrowserPluginTest();

  virtual void SetUp() OVERRIDE;
  virtual void TearDown() OVERRIDE;
  MockBrowserPluginManager* browser_plugin_manager() const {
    return static_cast<MockBrowserPluginManager*>(
        static_cast<RenderViewImpl*>(view_)->GetBrowserPluginManager());
  }
  std::string ExecuteScriptAndReturnString(const std::string& script);
  int ExecuteScriptAndReturnInt(const std::string& script);
  bool ExecuteScriptAndReturnBool(const std::string& script, bool* result);
  // Returns NULL if there is no plugin.
  MockBrowserPlugin* GetCurrentPlugin();
  // Returns NULL if there is no plugin.
  MockBrowserPlugin* GetCurrentPluginWithAttachParams(
      BrowserPluginHostMsg_Attach_Params* params);
 private:
  scoped_ptr<TestContentRendererClient> test_content_renderer_client_;
};

}  // namespace content

#endif //  CONTENT_RENDERER_BROWSER_PLUGIN_BROWSER_PLUGIN_BROWSERETEST_H_