Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(779)

Side by Side Diff: ppapi/proxy/ppp_instance_proxy_test.cc

Issue 7826017: Add PPB_Fullscreen;0.5. (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 9 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #include "base/synchronization/waitable_event.h" 5 #include "base/synchronization/waitable_event.h"
6 #include "ipc/ipc_message_utils.h" 6 #include "ipc/ipc_message_utils.h"
7 #include "ppapi/c/dev/ppb_fullscreen_dev.h" 7 #include "ppapi/c/dev/ppb_fullscreen_dev.h"
8 #include "ppapi/c/pp_var.h" 8 #include "ppapi/c/pp_var.h"
9 #include "ppapi/c/ppb_core.h" 9 #include "ppapi/c/ppb_core.h"
10 #include "ppapi/c/ppb_fullscreen.h"
10 #include "ppapi/c/ppb_url_loader.h" 11 #include "ppapi/c/ppb_url_loader.h"
11 #include "ppapi/c/ppp_instance.h" 12 #include "ppapi/c/ppp_instance.h"
12 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
13 #include "ppapi/proxy/ppapi_proxy_test.h" 14 #include "ppapi/proxy/ppapi_proxy_test.h"
14 15
15 namespace ppapi { 16 namespace ppapi {
16 namespace proxy { 17 namespace proxy {
17 18
18 namespace { 19 namespace {
19 // This is a poor man's mock of PPP_Instance using global variables. Eventually 20 // This is a poor man's mock of PPP_Instance using global variables. Eventually
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 } 89 }
89 90
90 PPP_Instance_1_0 ppp_instance_1_0 = { 91 PPP_Instance_1_0 ppp_instance_1_0 = {
91 &DidCreate, 92 &DidCreate,
92 &DidDestroy, 93 &DidDestroy,
93 &DidChangeView, 94 &DidChangeView,
94 &DidChangeFocus, 95 &DidChangeFocus,
95 &HandleDocumentLoad 96 &HandleDocumentLoad
96 }; 97 };
97 98
98 // PPP_Instance_Proxy::DidChangeView relies on PPB_FullscreenDev being 99 // PPP_Instance_Proxy::DidChangeView relies on PPB_Fullscreen(_Dev) being
99 // available with a valid implementation of IsFullScreen, so we mock it. 100 // available with a valid implementation of IsFullScreen, so we mock it.
100 PP_Bool IsFullscreen(PP_Instance instance) { 101 PP_Bool IsFullscreen(PP_Instance instance) {
101 return PP_FALSE; 102 return PP_FALSE;
102 } 103 }
104 PPB_Fullscreen ppb_fullscreen = { &IsFullscreen };
103 PPB_Fullscreen_Dev ppb_fullscreen_dev = { &IsFullscreen }; 105 PPB_Fullscreen_Dev ppb_fullscreen_dev = { &IsFullscreen };
104 106
105 } // namespace 107 } // namespace
106 108
107 class PPP_Instance_ProxyTest : public TwoWayTest { 109 class PPP_Instance_ProxyTest : public TwoWayTest {
108 public: 110 public:
109 PPP_Instance_ProxyTest() 111 PPP_Instance_ProxyTest()
110 : TwoWayTest(TwoWayTest::TEST_PPP_INTERFACE) { 112 : TwoWayTest(TwoWayTest::TEST_PPP_INTERFACE) {
111 } 113 }
112 }; 114 };
113 115
114 TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { 116 TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) {
115 plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0); 117 plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0);
116 host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, 118 host().RegisterTestInterface(PPB_FULLSCREEN_INTERFACE,
119 &ppb_fullscreen);
120 host().RegisterTestInterface(PPP_FULLSCREEN_DEV_INTERFACE,
117 &ppb_fullscreen_dev); 121 &ppb_fullscreen_dev);
118 122
119 // Grab the host-side proxy for the 1.0 interface. 123 // Grab the host-side proxy for the 1.0 interface.
120 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( 124 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>(
121 host().host_dispatcher()->GetProxiedInterface( 125 host().host_dispatcher()->GetProxiedInterface(
122 PPP_INSTANCE_INTERFACE_1_0)); 126 PPP_INSTANCE_INTERFACE_1_0));
123 127
124 // Call each function in turn, make sure we get the expected values and 128 // Call each function in turn, make sure we get the expected values and
125 // returns. 129 // returns.
126 // 130 //
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after
175 EXPECT_EQ(received_has_focus, expected_has_focus); 179 EXPECT_EQ(received_has_focus, expected_has_focus);
176 180
177 // TODO(dmichael): Need to mock out a resource Tracker to be able to test 181 // TODO(dmichael): Need to mock out a resource Tracker to be able to test
178 // HandleResourceLoad. It also requires 182 // HandleResourceLoad. It also requires
179 // PPB_Core.AddRefResource and for PPB_URLLoader to be 183 // PPB_Core.AddRefResource and for PPB_URLLoader to be
180 // registered. 184 // registered.
181 } 185 }
182 186
183 } // namespace proxy 187 } // namespace proxy
184 } // namespace ppapi 188 } // namespace ppapi
185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698