Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(945)

Unified Diff: ppapi/tests/test_view.cc

Issue 329033003: Add GetScrollOffset function to PPB_View (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
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();
+}

Powered by Google App Engine
This is Rietveld 408576698