summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 17:08:59 +0000
committerbrettw@chromium.org <brettw@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2011-07-19 17:08:59 +0000
commitcbe3e07b561b8c6a5f31fa94e566aae4bce67305 (patch)
treed651427665883b80a6ebf30a5f7e7bca3a4bc0e6 /ppapi/tests
parentc88cbfa32dfc9847277a753ffc464d806fa0a4ee (diff)
downloadchromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.zip
chromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.tar.gz
chromium_src-cbe3e07b561b8c6a5f31fa94e566aae4bce67305.tar.bz2
Update the widget API to use the new InputEvent resource rather than the old
PP_InputEvent struct. TEST=manual BUG=none Review URL: http://codereview.chromium.org/7399035 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@93044 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_scrollbar.cc21
-rw-r--r--ppapi/tests/test_scrollbar.h1
2 files changed, 16 insertions, 6 deletions
diff --git a/ppapi/tests/test_scrollbar.cc b/ppapi/tests/test_scrollbar.cc
index 973c51b..967d8d2 100644
--- a/ppapi/tests/test_scrollbar.cc
+++ b/ppapi/tests/test_scrollbar.cc
@@ -6,7 +6,9 @@
#include <cstring>
+#include "ppapi/c/dev/ppb_testing_dev.h"
#include "ppapi/c/pp_input_event.h"
+#include "ppapi/cpp/input_event.h"
#include "ppapi/cpp/instance.h"
#include "ppapi/cpp/rect.h"
#include "ppapi/tests/testing_instance.h"
@@ -20,6 +22,10 @@ TestScrollbar::TestScrollbar(TestingInstance* instance)
scrollbar_value_changed_(false) {
}
+bool TestScrollbar::Init() {
+ return InitTestingInterface();
+}
+
void TestScrollbar::RunTest() {
instance_->LogTest("HandleEvent", TestHandleEvent());
}
@@ -32,12 +38,15 @@ std::string TestScrollbar::TestHandleEvent() {
scrollbar_.SetDocumentSize(10000);
- PP_InputEvent event;
- std::memset(&event, 0, sizeof(event));
- event.type = PP_INPUTEVENT_TYPE_KEYDOWN;
- event.u.key.modifier = 0;
- event.u.key.key_code = 0x28; // VKEY_DOWN
- scrollbar_.HandleEvent(event);
+ pp::Core* core = pp::Module::Get()->core();
+ PP_Resource input_event = testing_interface_->CreateKeyboardInputEvent(
+ instance_->pp_instance(), PP_INPUTEVENT_TYPE_KEYDOWN,
+ core->GetTimeTicks(),
+ 0, // Modifier.
+ 0x28, // Key code = VKEY_DOWN.
+ PP_MakeUndefined());
+ scrollbar_.HandleEvent(pp::InputEvent(input_event));
+ core->ReleaseResource(input_event);
return scrollbar_value_changed_ ?
"" : "Didn't get callback for scrollbar value change";
diff --git a/ppapi/tests/test_scrollbar.h b/ppapi/tests/test_scrollbar.h
index 9a9bb1d..5211f97 100644
--- a/ppapi/tests/test_scrollbar.h
+++ b/ppapi/tests/test_scrollbar.h
@@ -16,6 +16,7 @@ class TestScrollbar : public TestCase,
TestScrollbar(TestingInstance* instance);
// TestCase implementation.
+ virtual bool Init();
virtual void RunTest();
private: