OLD | NEW |
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/pp_var.h" | 8 #include "ppapi/c/pp_var.h" |
8 #include "ppapi/c/ppb_core.h" | 9 #include "ppapi/c/ppb_core.h" |
9 #include "ppapi/c/ppb_url_loader.h" | 10 #include "ppapi/c/ppb_url_loader.h" |
10 #include "ppapi/c/ppp_instance.h" | 11 #include "ppapi/c/ppp_instance.h" |
11 #include "ppapi/c/private/ppb_flash_fullscreen.h" | 12 #include "ppapi/c/private/ppb_flash_fullscreen.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 { |
(...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
82 } | 83 } |
83 | 84 |
84 PPP_Instance_1_0 ppp_instance_1_0 = { | 85 PPP_Instance_1_0 ppp_instance_1_0 = { |
85 &DidCreate, | 86 &DidCreate, |
86 &DidDestroy, | 87 &DidDestroy, |
87 &DidChangeView, | 88 &DidChangeView, |
88 &DidChangeFocus, | 89 &DidChangeFocus, |
89 &HandleDocumentLoad | 90 &HandleDocumentLoad |
90 }; | 91 }; |
91 | 92 |
92 // PPP_Instance_Proxy::DidChangeView relies on PPB_Fullscreen being | 93 // PPP_Instance_Proxy::DidChangeView relies on PPB_(Flash)Fullscreen being |
93 // available with a valid implementation of IsFullScreen, so we mock it. | 94 // available with a valid implementation of IsFullScreen, so we mock it. |
94 PP_Bool IsFullscreen(PP_Instance instance) { | 95 PP_Bool IsFullscreen(PP_Instance instance) { |
95 return PP_FALSE; | 96 return PP_FALSE; |
96 } | 97 } |
| 98 PPB_Fullscreen_Dev ppb_fullscreen = { &IsFullscreen }; |
97 PPB_FlashFullscreen ppb_flash_fullscreen = { &IsFullscreen }; | 99 PPB_FlashFullscreen ppb_flash_fullscreen = { &IsFullscreen }; |
98 | 100 |
99 } // namespace | 101 } // namespace |
100 | 102 |
101 class PPP_Instance_ProxyTest : public TwoWayTest { | 103 class PPP_Instance_ProxyTest : public TwoWayTest { |
102 public: | 104 public: |
103 PPP_Instance_ProxyTest() | 105 PPP_Instance_ProxyTest() |
104 : TwoWayTest(TwoWayTest::TEST_PPP_INTERFACE) { | 106 : TwoWayTest(TwoWayTest::TEST_PPP_INTERFACE) { |
105 } | 107 } |
106 }; | 108 }; |
107 | 109 |
108 TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { | 110 TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) { |
109 plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0); | 111 plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0); |
110 host().RegisterTestInterface(PPB_FLASHFULLSCREEN_INTERFACE, | 112 host().RegisterTestInterface(PPB_FLASHFULLSCREEN_INTERFACE, |
111 &ppb_flash_fullscreen); | 113 &ppb_flash_fullscreen); |
| 114 host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE, |
| 115 &ppb_fullscreen); |
112 | 116 |
113 // Grab the host-side proxy for the 1.0 interface. | 117 // Grab the host-side proxy for the 1.0 interface. |
114 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( | 118 const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>( |
115 host().host_dispatcher()->GetProxiedInterface( | 119 host().host_dispatcher()->GetProxiedInterface( |
116 PPP_INSTANCE_INTERFACE_1_0)); | 120 PPP_INSTANCE_INTERFACE_1_0)); |
117 | 121 |
118 // Call each function in turn, make sure we get the expected values and | 122 // Call each function in turn, make sure we get the expected values and |
119 // returns. | 123 // returns. |
120 // | 124 // |
121 // We don't test DidDestroy, because it has the side-effect of removing the | 125 // We don't test DidDestroy, because it has the side-effect of removing the |
(...skipping 47 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
169 EXPECT_EQ(received_has_focus, expected_has_focus); | 173 EXPECT_EQ(received_has_focus, expected_has_focus); |
170 | 174 |
171 // TODO(dmichael): Need to mock out a resource Tracker to be able to test | 175 // TODO(dmichael): Need to mock out a resource Tracker to be able to test |
172 // HandleResourceLoad. It also requires | 176 // HandleResourceLoad. It also requires |
173 // PPB_Core.AddRefResource and for PPB_URLLoader to be | 177 // PPB_Core.AddRefResource and for PPB_URLLoader to be |
174 // registered. | 178 // registered. |
175 } | 179 } |
176 | 180 |
177 } // namespace proxy | 181 } // namespace proxy |
178 } // namespace ppapi | 182 } // namespace ppapi |
179 | |
OLD | NEW |