test_cursor_control.cc 1.2 KB

12345678910111213141516171819202122232425262728293031323334353637
  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
  3. // found in the LICENSE file.
  4. #include "ppapi/tests/test_cursor_control.h"
  5. #include "ppapi/c/dev/ppb_cursor_control_dev.h"
  6. #include "ppapi/cpp/module.h"
  7. #include "ppapi/tests/testing_instance.h"
  8. REGISTER_TEST_CASE(CursorControl);
  9. TestCursorControl::TestCursorControl(TestingInstance* instance)
  10. : TestCase(instance),
  11. cursor_control_interface_(NULL) {
  12. }
  13. bool TestCursorControl::Init() {
  14. cursor_control_interface_ = static_cast<const PPB_CursorControl_Dev*>(
  15. pp::Module::Get()->GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE));
  16. return !!cursor_control_interface_;
  17. }
  18. void TestCursorControl::RunTests(const std::string& filter) {
  19. RUN_TEST(SetCursor, filter);
  20. }
  21. std::string TestCursorControl::TestSetCursor() {
  22. // Very simplistic test to make sure we can actually call the function and
  23. // it reports success. This is a nice integration test to make sure the
  24. // interface is hooked up. Obviously it's not easy in a plugin to test whether
  25. // the mouse cursor actually changed.
  26. ASSERT_TRUE(cursor_control_interface_->SetCursor(instance_->pp_instance(),
  27. PP_CURSORTYPE_WAIT, 0, NULL));
  28. PASS();
  29. }