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

Unified Diff: ppapi/proxy/ppp_instance_proxy_test.cc

Issue 7362012: Remove untrusted scripting support. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merged 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
diff --git a/ppapi/proxy/ppp_instance_proxy_test.cc b/ppapi/proxy/ppp_instance_proxy_test.cc
index b545dd73fd54912da879bc3d3720c3df665ce1fa..00d776bf4afb366ea61421804a0fdb0a2883dac0 100644
--- a/ppapi/proxy/ppp_instance_proxy_test.cc
+++ b/ppapi/proxy/ppp_instance_proxy_test.cc
@@ -95,16 +95,6 @@ void ResetReceived() {
memset(&received_event, 0, sizeof(received_event));
}
-PPP_Instance_0_4 ppp_instance_0_4 = {
- &DidCreate,
- &DidDestroy,
- &DidChangeView,
- &DidChangeFocus,
- &HandleInputEvent,
- &HandleDocumentLoad,
- &GetInstanceObject
-};
-
PPP_Instance_0_5 ppp_instance_0_5 = {
&DidCreate,
&DidDestroy,
@@ -130,108 +120,6 @@ class PPP_Instance_ProxyTest : public TwoWayTest {
}
};
-TEST_F(PPP_Instance_ProxyTest, PPPInstance0_4) {
- plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_4, &ppp_instance_0_4);
- host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE,
- &ppb_fullscreen_dev);
-
- // Try requesting the 0.5 version, like the browser does. This should come
- // back NULL, since we're not registering 0.5. But this ensures that the
- // behavior through the proxy code reflects more closely what happens for a
- // real plug-in.
- const void* interface =
- host().host_dispatcher()->GetProxiedInterface(PPP_INSTANCE_INTERFACE_0_5);
- EXPECT_EQ(NULL, interface);
-
- // Grab the host-side proxy for the 0.4 interface.
- const PPP_Instance_0_4* ppp_instance = static_cast<const PPP_Instance_0_4*>(
- host().host_dispatcher()->GetProxiedInterface(
- PPP_INSTANCE_INTERFACE_0_4));
-
- // Call each function in turn, make sure we get the expected values and
- // returns.
- //
- // We don't test DidDestroy, because it has the side-effect of removing the
- // PP_Instance from the PluginDispatcher, which will cause a failure later
- // when the test is torn down.
- PP_Instance expected_instance = pp_instance();
- std::vector<std::string> expected_argn, expected_argv;
- expected_argn.push_back("Hello");
- expected_argn.push_back("world.");
- expected_argv.push_back("elloHay");
- expected_argv.push_back("orldway.");
- std::vector<const char*> argn_to_pass, argv_to_pass;
- CHECK(expected_argn.size() == expected_argv.size());
- for (size_t i = 0; i < expected_argn.size(); ++i) {
- argn_to_pass.push_back(expected_argn[i].c_str());
- argv_to_pass.push_back(expected_argv[i].c_str());
- }
- uint32_t expected_argc = expected_argn.size();
- bool_to_return = PP_TRUE;
- ResetReceived();
- EXPECT_EQ(bool_to_return, ppp_instance->DidCreate(expected_instance,
- expected_argc,
- &argn_to_pass[0],
- &argv_to_pass[0]));
- EXPECT_EQ(received_instance, expected_instance);
- EXPECT_EQ(received_argc, expected_argc);
- EXPECT_EQ(received_argn, expected_argn);
- EXPECT_EQ(received_argv, expected_argv);
-
- PP_Rect expected_position = { {1, 2}, {3, 4} };
- PP_Rect expected_clip = { {5, 6}, {7, 8} };
- ResetReceived();
- ppp_instance->DidChangeView(expected_instance, &expected_position,
- &expected_clip);
- did_change_view_called.Wait();
- EXPECT_EQ(received_instance, expected_instance);
- // If I define operator== for PP_Rect, it has to come before gtest's template
- // definitions in the translation unit, or else it's not found. So instead of
- // defining operator== before the #include that brings in gtest, I compare the
- // individual parts.
- EXPECT_EQ(received_position.point.x, expected_position.point.x);
- EXPECT_EQ(received_position.point.y, expected_position.point.y);
- EXPECT_EQ(received_position.size.width, expected_position.size.width);
- EXPECT_EQ(received_position.size.height, expected_position.size.height);
- EXPECT_EQ(received_clip.point.x, expected_clip.point.x);
- EXPECT_EQ(received_clip.point.y, expected_clip.point.y);
- EXPECT_EQ(received_clip.size.width, expected_clip.size.width);
- EXPECT_EQ(received_clip.size.height, expected_clip.size.height);
-
- PP_Bool expected_has_focus = PP_TRUE;
- ResetReceived();
- ppp_instance->DidChangeFocus(expected_instance, expected_has_focus);
- did_change_focus_called.Wait();
- 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
- // registered.
-
- var_to_return = PP_MakeInt32(100);
- ResetReceived();
- PP_Var result(ppp_instance->GetInstanceObject(expected_instance));
- ASSERT_EQ(var_to_return.type, result.type);
- EXPECT_EQ(var_to_return.value.as_int, result.value.as_int);
- EXPECT_EQ(received_instance, expected_instance);
-}
-
TEST_F(PPP_Instance_ProxyTest, PPPInstance0_5) {
plugin().RegisterTestInterface(PPP_INSTANCE_INTERFACE_0_5, &ppp_instance_0_5);
host().RegisterTestInterface(PPB_FULLSCREEN_DEV_INTERFACE,
« 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