Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / test / ppapi_unittest.h
blob15926c1718f0941fc9c4ef1f904bab03e5c97647
1 // Copyright (c) 2011 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.
5 #ifndef CONTENT_TEST_PPAPI_UNITTEST_H_
6 #define CONTENT_TEST_PPAPI_UNITTEST_H_
8 #include "base/basictypes.h"
9 #include "base/memory/ref_counted.h"
10 #include "base/memory/scoped_ptr.h"
11 #include "testing/gtest/include/gtest/gtest.h"
13 namespace base {
14 class MessageLoop;
17 namespace content {
19 class PepperPluginInstanceImpl;
20 class PluginModule;
22 class PpapiUnittest : public testing::Test {
23 public:
24 PpapiUnittest();
25 ~PpapiUnittest() override;
27 void SetUp() override;
28 void TearDown() override;
30 PluginModule* module() const { return module_.get(); }
31 PepperPluginInstanceImpl* instance() const { return instance_.get(); }
33 // Provides access to the interfaces implemented by the test. The default one
34 // implements PPP_INSTANCE.
35 virtual const void* GetMockInterface(const char* interface_name) const;
37 // Deletes the instance and module to simulate module shutdown.
38 void ShutdownModule();
40 // Sets the view size of the plugin instance.
41 void SetViewSize(int width, int height) const;
43 private:
44 // Note: module must be declared first since we want it to get destroyed last.
45 scoped_refptr<PluginModule> module_;
46 scoped_refptr<PepperPluginInstanceImpl> instance_;
48 scoped_ptr<base::MessageLoop> message_loop_;
50 DISALLOW_COPY_AND_ASSIGN(PpapiUnittest);
53 } // namespace content
55 #endif // CONTENT_TEST_PPAPI_UNITTEST_H_