| OLD | NEW |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 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 | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 #include "ppapi/tests/test_view.h" | 5 #include "ppapi/tests/test_view.h" |
| 6 | 6 |
| 7 #include <stddef.h> | 7 #include <stddef.h> |
| 8 | 8 |
| 9 #include <sstream> | 9 #include <sstream> |
| 10 | 10 |
| (...skipping 28 matching lines...) Expand all Loading... |
| 39 RUN_TEST(CreatedInvisible, filter); | 39 RUN_TEST(CreatedInvisible, filter); |
| 40 RUN_TEST(PageHideShow, filter); | 40 RUN_TEST(PageHideShow, filter); |
| 41 RUN_TEST(SizeChange, filter); | 41 RUN_TEST(SizeChange, filter); |
| 42 RUN_TEST(ClipChange, filter); | 42 RUN_TEST(ClipChange, filter); |
| 43 RUN_TEST(ScrollOffsetChange, filter); | 43 RUN_TEST(ScrollOffsetChange, filter); |
| 44 } | 44 } |
| 45 | 45 |
| 46 bool TestView::WaitUntilViewChanged() { | 46 bool TestView::WaitUntilViewChanged() { |
| 47 size_t old_page_visibility_change_count = page_visibility_log_.size(); | 47 size_t old_page_visibility_change_count = page_visibility_log_.size(); |
| 48 | 48 |
| 49 // Run a nested message loop. It will exit either on ViewChanged or if the | 49 // Run a nested run loop. It will exit either on ViewChanged or if the |
| 50 // timeout happens. | 50 // timeout happens. |
| 51 post_quit_on_view_changed_ = true; | 51 post_quit_on_view_changed_ = true; |
| 52 testing_interface_->RunMessageLoop(instance_->pp_instance()); | 52 testing_interface_->RunMessageLoop(instance_->pp_instance()); |
| 53 post_quit_on_view_changed_ = false; | 53 post_quit_on_view_changed_ = false; |
| 54 | 54 |
| 55 // We know we got a view changed event if something was appended to the log. | 55 // We know we got a view changed event if something was appended to the log. |
| 56 return page_visibility_log_.size() > old_page_visibility_change_count; | 56 return page_visibility_log_.size() > old_page_visibility_change_count; |
| 57 } | 57 } |
| 58 | 58 |
| 59 void TestView::QuitMessageLoop(int32_t result) { | 59 void TestView::QuitMessageLoop(int32_t result) { |
| (...skipping 126 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 186 | 186 |
| 187 instance_->EvalScript("window.scrollTo(0, 0);"); | 187 instance_->EvalScript("window.scrollTo(0, 0);"); |
| 188 | 188 |
| 189 while (WaitUntilViewChanged() && | 189 while (WaitUntilViewChanged() && |
| 190 last_view_.GetScrollOffset() != pp::Point(0, 0)) { | 190 last_view_.GetScrollOffset() != pp::Point(0, 0)) { |
| 191 } | 191 } |
| 192 ASSERT_EQ(pp::Point(0, 0), last_view_.GetScrollOffset()); | 192 ASSERT_EQ(pp::Point(0, 0), last_view_.GetScrollOffset()); |
| 193 | 193 |
| 194 PASS(); | 194 PASS(); |
| 195 } | 195 } |
| OLD | NEW |