Commit ba47b33c authored by polina@google.com's avatar polina@google.com

NaCl PPAPI Test Lib: Make PPP_Instance function defaults available via the

testing interface.

BUG=none
TEST=bots
Review URL: http://codereview.chromium.org/7740062

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@98949 0039d316-1c4b-4281-b951-d872f2087c98
parent 5dfcd854
// Copyright (c) 2011 The Native Client Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
...@@ -54,33 +54,6 @@ const char kKnownFileContents[] = ...@@ -54,33 +54,6 @@ const char kKnownFileContents[] =
"This is not an actual pdf file, just a " "This is not an actual pdf file, just a "
"test file so we can verify HandleDocumentLoad."; "test file so we can verify HandleDocumentLoad.";
PP_Bool DidCreate(PP_Instance instance,
uint32_t argc,
const char* argn[],
const char* argv[]) {
PP_Bool status = DidCreateDefault(instance, argc, argn, argv);
printf("DidCreate! %d\n", static_cast<int>(instance));
return status;
}
void DidDestroy(PP_Instance /* instance */) {
}
void DidChangeView(PP_Instance /* instance */,
const struct PP_Rect* /* position */,
const struct PP_Rect* /* clip */) {
}
void DidChangeFocus(PP_Instance /* instance */,
PP_Bool /* has_focus */) {
}
PP_Bool HandleInputEvent(PP_Instance /* instance */,
const struct PP_InputEvent* /* event */) {
return PP_FALSE;
}
void ReadCallback(void* user_data, int32_t pp_error_or_bytes) { void ReadCallback(void* user_data, int32_t pp_error_or_bytes) {
PP_Resource url_loader = reinterpret_cast<PP_Resource>(user_data); PP_Resource url_loader = reinterpret_cast<PP_Resource>(user_data);
...@@ -127,10 +100,10 @@ PP_Bool HandleDocumentLoad(PP_Instance instance, ...@@ -127,10 +100,10 @@ PP_Bool HandleDocumentLoad(PP_Instance instance,
} }
const PPP_Instance ppp_instance_interface = { const PPP_Instance ppp_instance_interface = {
DidCreate, DidCreateDefault,
DidDestroy, DidDestroyDefault,
DidChangeView, DidChangeViewDefault,
DidChangeFocus, DidChangeFocusDefault,
HandleDocumentLoad HandleDocumentLoad
}; };
......
// Copyright (c) 2011 The Native Client Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -93,31 +93,31 @@ PP_Bool DidCreateDefault(PP_Instance instance, ...@@ -93,31 +93,31 @@ PP_Bool DidCreateDefault(PP_Instance instance,
return PP_TRUE; return PP_TRUE;
} }
namespace { void DidDestroyDefault(PP_Instance /*instance*/) {
void DidDestroy(PP_Instance /*instance*/) {
} }
void DidChangeView(PP_Instance /*instance*/, void DidChangeViewDefault(PP_Instance /*instance*/,
const struct PP_Rect* /*position*/, const struct PP_Rect* /*position*/,
const struct PP_Rect* /*clip*/) { const struct PP_Rect* /*clip*/) {
} }
void DidChangeFocus(PP_Instance /*instance*/, void DidChangeFocusDefault(PP_Instance /*instance*/,
PP_Bool /*has_focus*/) { PP_Bool /*has_focus*/) {
} }
PP_Bool HandleDocumentLoad(PP_Instance instance, PP_Bool HandleDocumentLoadDefault(PP_Instance instance,
PP_Resource url_loader) { PP_Resource url_loader) {
return PP_TRUE; return PP_TRUE;
} }
namespace {
const PPP_Instance ppp_instance_interface = { const PPP_Instance ppp_instance_interface = {
DidCreateDefault, DidCreateDefault,
DidDestroy, DidDestroyDefault,
DidChangeView, DidChangeViewDefault,
DidChangeFocus, DidChangeFocusDefault,
HandleDocumentLoad HandleDocumentLoadDefault
}; };
/////////////////////////////////////////////////////////////////////////////// ///////////////////////////////////////////////////////////////////////////////
......
// Copyright (c) 2011 The Native Client Authors. All rights reserved. // Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be // Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file. // found in the LICENSE file.
// //
...@@ -171,5 +171,12 @@ PP_Module pp_module(); ...@@ -171,5 +171,12 @@ PP_Module pp_module();
// call this function to ensure proper test set-up. // call this function to ensure proper test set-up.
PP_Bool DidCreateDefault(PP_Instance instance, PP_Bool DidCreateDefault(PP_Instance instance,
uint32_t argc, const char* argn[], const char* argv[]); uint32_t argc, const char* argn[], const char* argv[]);
// Other default implementations of the required PPP_Instance functions.
void DidDestroyDefault(PP_Instance instance);
void DidChangeViewDefault(PP_Instance instance,
const struct PP_Rect* position,
const struct PP_Rect* clip);
void DidChangeFocusDefault(PP_Instance instance, PP_Bool has_focus);
PP_Bool HandleDocumentLoadDefault(PP_Instance instance, PP_Resource url_loader);
#endif // NATIVE_CLIENT_TESTS_PPAPI_TEST_PPB_TEMPLATE_TEST_INTERFACE_H #endif // NATIVE_CLIENT_TESTS_PPAPI_TEST_PPB_TEMPLATE_TEST_INTERFACE_H
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment