| Index: ppapi/tests/test_view.cc
|
| diff --git a/ppapi/tests/test_view.cc b/ppapi/tests/test_view.cc
|
| index d141c05d1f3f704f228c981ef296d2857215c22e..5ce903a71375c888449e409be5b8a82130545576 100644
|
| --- a/ppapi/tests/test_view.cc
|
| +++ b/ppapi/tests/test_view.cc
|
| @@ -46,6 +46,7 @@ void TestView::RunTests(const std::string& filter) {
|
| RUN_TEST(PageHideShow, filter);
|
| RUN_TEST(SizeChange, filter);
|
| RUN_TEST(ClipChange, filter);
|
| + RUN_TEST(ScrollOffsetChange, filter);
|
| }
|
|
|
| bool TestView::WaitUntilViewChanged() {
|
| @@ -199,3 +200,29 @@ std::string TestView::TestClipChange() {
|
| ASSERT_TRUE(last_view_.GetClipRect() == desired_clip);
|
| PASS();
|
| }
|
| +
|
| +std::string TestView::TestScrollOffsetChange() {
|
| + instance_->EvalScript("document.body.style.width = '5000px';"
|
| + "document.body.style.height = '5000px';");
|
| + instance_->EvalScript("window.scrollTo(5, 1);");
|
| +
|
| + PP_Time begin_time = pp::Module::Get()->core()->GetTime();
|
| + while (WaitUntilViewChanged() &&
|
| + last_view_.GetScrollOffset() != pp::Point(5, 1) &&
|
| + pp::Module::Get()->core()->GetTime() - begin_time <
|
| + kViewChangeTimeoutSec) {
|
| + }
|
| + ASSERT_EQ(pp::Point(5, 1), last_view_.GetScrollOffset());
|
| +
|
| + instance_->EvalScript("window.scrollTo(0, 0);");
|
| +
|
| + begin_time = pp::Module::Get()->core()->GetTime();
|
| + while (WaitUntilViewChanged() &&
|
| + last_view_.GetScrollOffset() != pp::Point(0, 0) &&
|
| + pp::Module::Get()->core()->GetTime() - begin_time <
|
| + kViewChangeTimeoutSec) {
|
| + }
|
| + ASSERT_EQ(pp::Point(0, 0), last_view_.GetScrollOffset());
|
| +
|
| + PASS();
|
| +}
|
|
|