- add sources.
[platform/framework/web/crosswalk.git] / src / content / test / ppapi_unittest.h
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.
4
5 #ifndef CONTENT_TEST_PPAPI_UNITTEST_H_
6 #define CONTENT_TEST_PPAPI_UNITTEST_H_
7
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"
12
13 namespace base {
14 class MessageLoop;
15 }
16
17 namespace content {
18
19 class PepperPluginInstanceImpl;
20 class PluginModule;
21
22 class PpapiUnittest : public testing::Test {
23  public:
24   PpapiUnittest();
25   virtual ~PpapiUnittest();
26
27   virtual void SetUp();
28   virtual void TearDown();
29
30   PluginModule* module() const { return module_.get(); }
31   PepperPluginInstanceImpl* instance() const { return instance_.get(); }
32
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;
36
37   // Deletes the instance and module to simulate module shutdown.
38   void ShutdownModule();
39
40   // Sets the view size of the plugin instance.
41   void SetViewSize(int width, int height) const;
42
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_;
47
48   scoped_ptr<base::MessageLoop> message_loop_;
49
50   DISALLOW_COPY_AND_ASSIGN(PpapiUnittest);
51 };
52
53 }  // namespace content
54
55 #endif  // CONTENT_TEST_PPAPI_UNITTEST_H_