summaryrefslogtreecommitdiffstats
path: root/ppapi/tests
diff options
context:
space:
mode:
authorpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 22:04:09 +0000
committerpolina@google.com <polina@google.com@0039d316-1c4b-4281-b951-d872f2087c98>2011-09-23 22:04:09 +0000
commitf949c9cea80575097d0ad9f5a0652c319a31a20c (patch)
tree647a862953c9e0994bea54836cb114cb37c0a4a8 /ppapi/tests
parent9e7cf2333938119f508fe46ca70eb11da016dbad (diff)
downloadchromium_src-f949c9cea80575097d0ad9f5a0652c319a31a20c.zip
chromium_src-f949c9cea80575097d0ad9f5a0652c319a31a20c.tar.gz
chromium_src-f949c9cea80575097d0ad9f5a0652c319a31a20c.tar.bz2
ppapi_tests: Add a way for TestCase to implement HandleInputEvent.
Review URL: http://codereview.chromium.org/7973018 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@102597 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'ppapi/tests')
-rw-r--r--ppapi/tests/test_case.cc10
-rw-r--r--ppapi/tests/test_case.h5
-rw-r--r--ppapi/tests/testing_instance.cc6
-rw-r--r--ppapi/tests/testing_instance.h1
4 files changed, 20 insertions, 2 deletions
diff --git a/ppapi/tests/test_case.cc b/ppapi/tests/test_case.cc
index 9f0675e..8245c25 100644
--- a/ppapi/tests/test_case.cc
+++ b/ppapi/tests/test_case.cc
@@ -50,9 +50,15 @@ pp::VarPrivate TestCase::GetTestObject() {
}
#endif
-void TestCase::HandleMessage(const pp::Var& message_data) {}
+void TestCase::HandleMessage(const pp::Var& message_data) {
+}
+
+void TestCase::DidChangeView(const pp::Rect& position, const pp::Rect& clip) {
+}
-void TestCase::DidChangeView(const pp::Rect& position, const pp::Rect& clip) {}
+bool TestCase::HandleInputEvent(const pp::InputEvent& event) {
+ return false;
+}
#if !(defined __native_client__)
pp::deprecated::ScriptableObject* TestCase::CreateTestObject() {
diff --git a/ppapi/tests/test_case.h b/ppapi/tests/test_case.h
index 975e666..05e0d32 100644
--- a/ppapi/tests/test_case.h
+++ b/ppapi/tests/test_case.h
@@ -61,6 +61,11 @@ class TestCase {
// that want to handle view changes should override this method.
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
+ // A function that is invoked whenever HandleInputEvent is called on the
+ // associated TestingInstance. Default implementation returns false. TestCases
+ // that want to handle view changes should override this method.
+ virtual bool HandleInputEvent(const pp::InputEvent& event);
+
protected:
#if !(defined __native_client__)
// Overridden by each test to supply a ScriptableObject corresponding to the
diff --git a/ppapi/tests/testing_instance.cc b/ppapi/tests/testing_instance.cc
index 9332bbc..e50bb5a3 100644
--- a/ppapi/tests/testing_instance.cc
+++ b/ppapi/tests/testing_instance.cc
@@ -94,6 +94,12 @@ void TestingInstance::DidChangeView(const pp::Rect& position,
current_case_->DidChangeView(position, clip);
}
+bool TestingInstance::HandleInputEvent(const pp::InputEvent& event) {
+ if (current_case_)
+ return current_case_->HandleInputEvent(event);
+ return false;
+}
+
void TestingInstance::LogTest(const std::string& test_name,
const std::string& error_message) {
// Tell the browser we're still working.
diff --git a/ppapi/tests/testing_instance.h b/ppapi/tests/testing_instance.h
index d27a0bf..0c79923 100644
--- a/ppapi/tests/testing_instance.h
+++ b/ppapi/tests/testing_instance.h
@@ -49,6 +49,7 @@ pp::InstancePrivate {
// pp::Instance override.
virtual bool Init(uint32_t argc, const char* argn[], const char* argv[]);
virtual void DidChangeView(const pp::Rect& position, const pp::Rect& clip);
+ virtual bool HandleInputEvent(const pp::InputEvent& event);
#if !(defined __native_client__)
virtual pp::Var GetInstanceObject();