Android: Remove unneeded Compositor::SetNeedsRedraw()
[chromium-blink-merge.git] / ppapi / tests / test_scrollbar.cc
blobcde40a7c7edb910768fdf00f672f8278096b91ae
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.
5 #include "ppapi/tests/test_scrollbar.h"
7 #include <cstring>
9 #include "ppapi/c/dev/ppb_testing_dev.h"
10 #include "ppapi/c/pp_input_event.h"
11 #include "ppapi/cpp/input_event.h"
12 #include "ppapi/cpp/instance.h"
13 #include "ppapi/cpp/rect.h"
14 #include "ppapi/tests/testing_instance.h"
16 REGISTER_TEST_CASE(Scrollbar);
18 TestScrollbar::TestScrollbar(TestingInstance* instance)
19 : TestCase(instance),
20 WidgetClient_Dev(instance),
21 scrollbar_(instance, true),
22 scrollbar_value_changed_(false) {
25 bool TestScrollbar::Init() {
26 return CheckTestingInterface();
29 void TestScrollbar::RunTests(const std::string& filter) {
30 RUN_TEST(HandleEvent, filter);
33 std::string TestScrollbar::TestHandleEvent() {
34 pp::Rect location;
35 location.set_width(1000);
36 location.set_height(1000);
37 scrollbar_.SetLocation(location);
39 scrollbar_.SetDocumentSize(10000);
41 pp::Core* core = pp::Module::Get()->core();
42 pp::KeyboardInputEvent input_event(
43 instance_, PP_INPUTEVENT_TYPE_KEYDOWN,
44 core->GetTimeTicks(),
45 0, // Modifier.
46 0x28, // Key code = VKEY_DOWN.
47 pp::Var());
48 scrollbar_.HandleEvent(input_event);
50 return scrollbar_value_changed_ ?
51 "" : "Didn't get callback for scrollbar value change";
54 void TestScrollbar::InvalidateWidget(pp::Widget_Dev widget,
55 const pp::Rect& dirty_rect) {
58 void TestScrollbar::ScrollbarValueChanged(pp::Scrollbar_Dev scrollbar,
59 uint32_t value) {
60 if (scrollbar == scrollbar_)
61 scrollbar_value_changed_ = true;
64 void TestScrollbar::ScrollbarOverlayChanged(pp::Scrollbar_Dev scrollbar,
65 bool type) {