- add sources.
[platform/framework/web/crosswalk.git] / src / ppapi / tests / test_cursor_control.cc
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
5 #include "ppapi/tests/test_cursor_control.h"
6
7 #include "ppapi/c/dev/ppb_cursor_control_dev.h"
8 #include "ppapi/cpp/module.h"
9 #include "ppapi/tests/testing_instance.h"
10
11 REGISTER_TEST_CASE(CursorControl);
12
13 TestCursorControl::TestCursorControl(TestingInstance* instance)
14     : TestCase(instance),
15       cursor_control_interface_(NULL) {
16 }
17
18 bool TestCursorControl::Init() {
19   cursor_control_interface_ = static_cast<const PPB_CursorControl_Dev*>(
20       pp::Module::Get()->GetBrowserInterface(PPB_CURSOR_CONTROL_DEV_INTERFACE));
21   return !!cursor_control_interface_;
22 }
23
24 void TestCursorControl::RunTests(const std::string& filter) {
25   RUN_TEST(SetCursor, filter);
26 }
27
28 std::string TestCursorControl::TestSetCursor() {
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
31   // interface is hooked up. Obviously it's not easy in a plugin to test whether
32   // the mouse cursor actually changed.
33   ASSERT_TRUE(cursor_control_interface_->SetCursor(instance_->pp_instance(),
34       PP_CURSORTYPE_WAIT, 0, NULL));
35
36   PASS();
37 }