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

Side by Side Diff: trunk/src/ppapi/proxy/ppp_instance_proxy_unittest.cc

Issue 12920003: Revert 189518 "PPAPI: Remove threading options; it's always on" (Closed) Base URL: svn://svn.chromium.org/chrome/
Patch Set: Created 7 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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/pp_var.h" 7 #include "ppapi/c/pp_var.h"
8 #include "ppapi/c/ppb_core.h" 8 #include "ppapi/c/ppb_core.h"
9 #include "ppapi/c/ppb_fullscreen.h" 9 #include "ppapi/c/ppb_fullscreen.h"
10 #include "ppapi/c/ppb_url_loader.h" 10 #include "ppapi/c/ppb_url_loader.h"
11 #include "ppapi/c/ppp_instance.h" 11 #include "ppapi/c/ppp_instance.h"
12 #include "ppapi/c/private/ppb_flash_fullscreen.h" 12 #include "ppapi/c/private/ppb_flash_fullscreen.h"
13 #include "ppapi/proxy/locking_resource_releaser.h"
14 #include "ppapi/proxy/ppapi_messages.h" 13 #include "ppapi/proxy/ppapi_messages.h"
15 #include "ppapi/proxy/ppapi_proxy_test.h" 14 #include "ppapi/proxy/ppapi_proxy_test.h"
16 #include "ppapi/shared_impl/ppb_view_shared.h" 15 #include "ppapi/shared_impl/ppb_view_shared.h"
16 #include "ppapi/shared_impl/scoped_pp_resource.h"
17 17
18 namespace ppapi { 18 namespace ppapi {
19 namespace proxy { 19 namespace proxy {
20 20
21 namespace { 21 namespace {
22 // This is a poor man's mock of PPP_Instance using global variables. Eventually 22 // This is a poor man's mock of PPP_Instance using global variables. Eventually
23 // we should generalize making PPAPI interface mocks by using IDL or macro/ 23 // we should generalize making PPAPI interface mocks by using IDL or macro/
24 // template magic. 24 // template magic.
25 PP_Instance received_instance; 25 PP_Instance received_instance;
26 uint32_t received_argc; 26 uint32_t received_argc;
(...skipping 129 matching lines...) Expand 10 before | Expand all | Expand 10 after
156 156
157 PP_Rect expected_position = { {1, 2}, {3, 4} }; 157 PP_Rect expected_position = { {1, 2}, {3, 4} };
158 PP_Rect expected_clip = { {5, 6}, {7, 8} }; 158 PP_Rect expected_clip = { {5, 6}, {7, 8} };
159 ViewData data; 159 ViewData data;
160 data.rect = expected_position; 160 data.rect = expected_position;
161 data.is_fullscreen = false; 161 data.is_fullscreen = false;
162 data.is_page_visible = true; 162 data.is_page_visible = true;
163 data.clip_rect = expected_clip; 163 data.clip_rect = expected_clip;
164 data.device_scale = 1.0f; 164 data.device_scale = 1.0f;
165 ResetReceived(); 165 ResetReceived();
166 LockingResourceReleaser view_resource( 166 ScopedPPResource view_resource(
167 ScopedPPResource::PassRef(),
167 (new PPB_View_Shared(OBJECT_IS_IMPL, 168 (new PPB_View_Shared(OBJECT_IS_IMPL,
168 expected_instance, data))->GetReference()); 169 expected_instance, data))->GetReference());
169 ppp_instance->DidChangeView(expected_instance, view_resource.get()); 170 ppp_instance->DidChangeView(expected_instance, view_resource);
170 did_change_view_called.Wait(); 171 did_change_view_called.Wait();
171 EXPECT_EQ(received_instance, expected_instance); 172 EXPECT_EQ(received_instance, expected_instance);
172 EXPECT_EQ(received_position.point.x, expected_position.point.x); 173 EXPECT_EQ(received_position.point.x, expected_position.point.x);
173 EXPECT_EQ(received_position.point.y, expected_position.point.y); 174 EXPECT_EQ(received_position.point.y, expected_position.point.y);
174 EXPECT_EQ(received_position.size.width, expected_position.size.width); 175 EXPECT_EQ(received_position.size.width, expected_position.size.width);
175 EXPECT_EQ(received_position.size.height, expected_position.size.height); 176 EXPECT_EQ(received_position.size.height, expected_position.size.height);
176 EXPECT_EQ(received_clip.point.x, expected_clip.point.x); 177 EXPECT_EQ(received_clip.point.x, expected_clip.point.x);
177 EXPECT_EQ(received_clip.point.y, expected_clip.point.y); 178 EXPECT_EQ(received_clip.point.y, expected_clip.point.y);
178 EXPECT_EQ(received_clip.size.width, expected_clip.size.width); 179 EXPECT_EQ(received_clip.size.width, expected_clip.size.width);
179 EXPECT_EQ(received_clip.size.height, expected_clip.size.height); 180 EXPECT_EQ(received_clip.size.height, expected_clip.size.height);
180 181
181 PP_Bool expected_has_focus = PP_TRUE; 182 PP_Bool expected_has_focus = PP_TRUE;
182 ResetReceived(); 183 ResetReceived();
183 ppp_instance->DidChangeFocus(expected_instance, expected_has_focus); 184 ppp_instance->DidChangeFocus(expected_instance, expected_has_focus);
184 did_change_focus_called.Wait(); 185 did_change_focus_called.Wait();
185 EXPECT_EQ(received_instance, expected_instance); 186 EXPECT_EQ(received_instance, expected_instance);
186 EXPECT_EQ(received_has_focus, expected_has_focus); 187 EXPECT_EQ(received_has_focus, expected_has_focus);
187 188
188 // TODO(dmichael): Need to mock out a resource Tracker to be able to test 189 // TODO(dmichael): Need to mock out a resource Tracker to be able to test
189 // HandleResourceLoad. It also requires 190 // HandleResourceLoad. It also requires
190 // PPB_Core.AddRefResource and for PPB_URLLoader to be 191 // PPB_Core.AddRefResource and for PPB_URLLoader to be
191 // registered. 192 // registered.
192 193
193 host().resource_tracker().DidDeleteInstance(expected_instance); 194 host().resource_tracker().DidDeleteInstance(expected_instance);
194 } 195 }
195 196
196 } // namespace proxy 197 } // namespace proxy
197 } // namespace ppapi 198 } // namespace ppapi
OLDNEW
« no previous file with comments | « trunk/src/ppapi/proxy/ppp_instance_private_proxy_unittest.cc ('k') | trunk/src/ppapi/proxy/printing_resource_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698