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

Unified Diff: ppapi/proxy/ppp_instance_proxy_test.cc

Issue 7471006: Revert 93223 - Reland http://codereview.chromium.org/7452002/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 9 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy.cc ('k') | ppapi/shared_impl/ppp_instance_combined.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: ppapi/proxy/ppp_instance_proxy_test.cc
===================================================================
--- ppapi/proxy/ppp_instance_proxy_test.cc (revision 93228)
+++ ppapi/proxy/ppp_instance_proxy_test.cc (working copy)
@@ -60,6 +60,13 @@
did_change_focus_called.Signal();
}
+PP_InputEvent received_event;
+PP_Bool HandleInputEvent(PP_Instance instance, const PP_InputEvent* event) {
+ received_instance = instance;
+ memcpy(&received_event, event, sizeof(*event));;
+ return bool_to_return;
+}
+
PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Resource url_loader) {
// This one requires use of the PPB_URLLoader proxy and PPB_Core, plus a
// resource tracker for the url_loader resource.
@@ -85,13 +92,15 @@
memset(&received_position, 0, sizeof(received_position));
memset(&received_clip, 0, sizeof(received_clip));
received_has_focus = PP_FALSE;
+ memset(&received_event, 0, sizeof(received_event));
}
-PPP_Instance_1_0 ppp_instance_1_0 = {
+PPP_Instance_0_5 ppp_instance_0_5 = {
&DidCreate,
&DidDestroy,
&DidChangeView,
&DidChangeFocus,
+ &HandleInputEvent,
&HandleDocumentLoad
};
@@ -111,15 +120,15 @@
}
};
-TEST_F(PPP_Instance_ProxyTest, PPPInstance1_0) {
- plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_1_0, &ppp_instance_1_0);
+TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) {
+ plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_5, &ppp_instance_0_5);
host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE,
&ppb_fullscreen_dev);
- // Grab the host-side proxy for the 1.0 interface.
- const PPP_Instance_1_0* ppp_instance = static_cast<const PPP_Instance_1_0*>(
+ // Grab the host-side proxy for the 0.5 interface.
+ const PPP_Instance_0_5* ppp_instance = static_cast<const PPP_Instance_0_5*>(
host().host_dispatcher()->GetProxiedInterface(
- PPP_INSTANCE_INTERFACE_1_0));
+ PPP_INSTANCE_INTERFACE_0_5));
// Call each function in turn, make sure we get the expected values and
// returns.
@@ -174,6 +183,20 @@
EXPECT_EQ(received_instance, expected_instance);
EXPECT_EQ(received_has_focus, expected_has_focus);
+ PP_InputEvent expected_event = { PP_INPUTEVENT_TYPE_KEYDOWN, // type
+ 0, // padding
+ 1.0, // time_stamp
+ { { 2, 3 } } }; // u (as PP_InputEvent_Key)
+ ResetReceived();
+ EXPECT_EQ(bool_to_return,
+ ppp_instance->HandleInputEvent(expected_instance, &expected_event));
+ EXPECT_EQ(received_instance, expected_instance);
+ ASSERT_EQ(received_event.type, expected_event.type);
+ // Ignore padding; it's okay if it's not serialized.
+ EXPECT_EQ(received_event.time_stamp, expected_event.time_stamp);
+ EXPECT_EQ(received_event.u.key.modifier, expected_event.u.key.modifier);
+ EXPECT_EQ(received_event.u.key.key_code, expected_event.u.key.key_code);
+
// TODO(dmichael): Need to mock out a resource Tracker to be able to test
// HandleResourceLoad. It also requires
// PPB_Core.AddRefResource and for PPB_URLLoader to be
« no previous file with comments | « ppapi/proxy/ppp_instance_proxy.cc ('k') | ppapi/shared_impl/ppp_instance_combined.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698