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 #ifndef PPAPI_TEST_TEST_VIEW_H_
6 #define PPAPI_TEST_TEST_VIEW_H_
8 #include "ppapi/cpp/view.h"
9 #include "ppapi/tests/test_case.h"
11 class TestView
: public TestCase
{
13 TestView(TestingInstance
* instance
);
15 virtual void DidChangeView(const pp::View
& view
);
17 // TestCase implementation.
19 virtual void RunTests(const std::string
& test_filter
);
22 // Waits until we get a view changed event. Note that the browser may give
23 // us any number of view changed events, so tests that use this should
24 // expect that there may be spurious events and handle them accordingly.
25 // Note also that view changed sequencing can change between different
26 // versions of WebKit.
28 // Returns true if we got a view changed, false if it timed out.
29 bool WaitUntilViewChanged();
31 void QuitMessageLoop(int32_t result
);
33 std::string
TestCreatedVisible();
34 std::string
TestCreatedInvisible();
35 std::string
TestPageHideShow();
36 std::string
TestSizeChange();
37 std::string
TestClipChange();
38 std::string
TestScrollOffsetChange();
42 // DidChangeView stores the page visibility in this vector on each
43 // invocation so tests can check it.
44 std::vector
<bool> page_visibility_log_
;
46 // Set to true to request that the next invocation of DidChangeView should
47 // post a quit to the message loop. DidChangeView will also reset the flag so
48 // this will only happen once.
49 bool post_quit_on_view_changed_
;
52 #endif // PPAPI_TEST_TEST_VIEW_H_