Index: ppapi/tests/test_view.cc |
diff --git a/ppapi/tests/test_view.cc b/ppapi/tests/test_view.cc |
index d141c05d1f3f704f228c981ef296d2857215c22e..95169733b94089430bd40f121464ade96564a3c6 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_TRUE(last_view_.GetScrollOffset() == pp::Point(5, 1)); |
dmichael (off chromium)
2014/06/16 22:31:56
Does ASSERT_EQ work? Not sure since I added the lo
raymes
2014/06/17 00:43:00
Done.
|
+ |
+ 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_TRUE(last_view_.GetScrollOffset() == pp::Point(0, 0)); |
+ |
+ PASS(); |
+} |