| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/tests/test_cursor_control.h" | 5 #include "ppapi/tests/test_cursor_control.h" |
| 6 | 6 |
| 7 #include "ppapi/c/dev/ppb_cursor_control_dev.h" | 7 #include "ppapi/c/dev/ppb_cursor_control_dev.h" |
| 8 #include "ppapi/cpp/module.h" | 8 #include "ppapi/cpp/module.h" |
| 9 #include "ppapi/tests/testing_instance.h" | 9 #include "ppapi/tests/testing_instance.h" |
| 10 | 10 |
| 11 REGISTER_TEST_CASE(CursorControl); | 11 REGISTER_TEST_CASE(CursorControl); |
| 12 | 12 |
| 13 TestCursorControl::TestCursorControl(TestingInstance* instance) | 13 TestCursorControl::TestCursorControl(TestingInstance* instance) |
| 14 : TestCase(instance), | 14 : TestCase(instance), |
| 15 cursor_control_interface_(NULL) { | 15 cursor_control_interface_(NULL) { |
| 16 } | 16 } |
| 17 | 17 |
| 18 bool TestCursorControl::Init() { | 18 bool TestCursorControl::Init() { |
| 19 cursor_control_interface_ = static_cast<PPB_CursorControl_Dev const*>( | 19 cursor_control_interface_ = static_cast<const PPB_CursorControl_Dev*>( |
| 20 pp::Module::Get()->GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE)); | 20 pp::Module::Get()->GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE)); |
| 21 return !!cursor_control_interface_; | 21 return !!cursor_control_interface_; |
| 22 } | 22 } |
| 23 | 23 |
| 24 void TestCursorControl::RunTests(const std::string& filter) { | 24 void TestCursorControl::RunTests(const std::string& filter) { |
| 25 RUN_TEST(SetCursor, filter); | 25 RUN_TEST(SetCursor, filter); |
| 26 } | 26 } |
| 27 | 27 |
| 28 std::string TestCursorControl::TestSetCursor() { | 28 std::string TestCursorControl::TestSetCursor() { |
| 29 // Very simplistic test to make sure we can actually call the function and | 29 // Very simplistic test to make sure we can actually call the function and |
| 30 // it reports success. This is a nice integration test to make sure the | 30 // it reports success. This is a nice integration test to make sure the |
| 31 // interface is hooked up. Obviously it's not easy in a plugin to test whether | 31 // interface is hooked up. Obviously it's not easy in a plugin to test whether |
| 32 // the mouse cursor actually changed. | 32 // the mouse cursor actually changed. |
| 33 ASSERT_TRUE(cursor_control_interface_->SetCursor(instance_->pp_instance(), | 33 ASSERT_TRUE(cursor_control_interface_->SetCursor(instance_->pp_instance(), |
| 34 PP_CURSORTYPE_WAIT, 0, NULL)); | 34 PP_CURSORTYPE_WAIT, 0, NULL)); |
| 35 | 35 |
| 36 PASS(); | 36 PASS(); |
| 37 } | 37 } |
| OLD | NEW |