| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <map> | 5 #include <map> |
| 6 #include <queue> | 6 #include <queue> |
| 7 #include <utility> | 7 #include <utility> |
| 8 | 8 |
| 9 #include "android_webview/browser/browser_view_renderer.h" | 9 #include "android_webview/browser/browser_view_renderer.h" |
| 10 #include "android_webview/browser/child_frame.h" | 10 #include "android_webview/browser/child_frame.h" |
| (...skipping 60 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 71 void WillOnDraw() override { | 71 void WillOnDraw() override { |
| 72 RenderingTest::WillOnDraw(); | 72 RenderingTest::WillOnDraw(); |
| 73 // Step 0: A single onDraw on screen. The parent draw constraints | 73 // Step 0: A single onDraw on screen. The parent draw constraints |
| 74 // of the BVR will updated to be the initial constraints. | 74 // of the BVR will updated to be the initial constraints. |
| 75 // Step 1: A single onDrraw off screen. The parent draw constraints of the | 75 // Step 1: A single onDrraw off screen. The parent draw constraints of the |
| 76 // BVR will be updated to the new constraints. | 76 // BVR will be updated to the new constraints. |
| 77 // Step 2: This onDraw is to introduce the DrawGL that animates the | 77 // Step 2: This onDraw is to introduce the DrawGL that animates the |
| 78 // webview onto the screen on render thread. End the test when the parent | 78 // webview onto the screen on render thread. End the test when the parent |
| 79 // draw constraints of BVR is updated to initial constraints. | 79 // draw constraints of BVR is updated to initial constraints. |
| 80 if (on_draw_count_ == 1 || on_draw_count_ == 2) | 80 if (on_draw_count_ == 1 || on_draw_count_ == 2) |
| 81 browser_view_renderer_->PrepareToDraw(gfx::Vector2d(), gfx::Rect()); | 81 browser_view_renderer_->PrepareToDraw(gfx::Rect()); |
| 82 } | 82 } |
| 83 | 83 |
| 84 void DidOnDraw(bool success) override { | 84 void DidOnDraw(bool success) override { |
| 85 EXPECT_TRUE(success); | 85 EXPECT_TRUE(success); |
| 86 on_draw_count_++; | 86 on_draw_count_++; |
| 87 } | 87 } |
| 88 | 88 |
| 89 bool WillDrawOnRT(SharedRendererState* functor, | 89 bool WillDrawOnRT(SharedRendererState* functor, |
| 90 AwDrawGLInfo* draw_info) override { | 90 AwDrawGLInfo* draw_info) override { |
| 91 if (draw_gl_count_on_rt_ == 1) { | 91 if (draw_gl_count_on_rt_ == 1) { |
| (...skipping 24 matching lines...) Expand all Loading... |
| 116 const ParentCompositorDrawConstraints& constraints1, | 116 const ParentCompositorDrawConstraints& constraints1, |
| 117 const ParentCompositorDrawConstraints& constraints2) { | 117 const ParentCompositorDrawConstraints& constraints2) { |
| 118 if (constraints1.is_layer != constraints2.is_layer || | 118 if (constraints1.is_layer != constraints2.is_layer || |
| 119 constraints1.transform != constraints2.transform) | 119 constraints1.transform != constraints2.transform) |
| 120 return false; | 120 return false; |
| 121 | 121 |
| 122 return !constraints1.is_layer || | 122 return !constraints1.is_layer || |
| 123 constraints1.surface_rect_empty == constraints2.surface_rect_empty; | 123 constraints1.surface_rect_empty == constraints2.surface_rect_empty; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void ParentDrawConstraintsUpdated( | 126 void DrawConstraintsUpdated( |
| 127 const ParentCompositorDrawConstraints& constraints) override { | 127 const ParentCompositorDrawConstraints& constraints) override { |
| 128 switch (on_draw_count_) { | 128 switch (on_draw_count_) { |
| 129 case 1u: | 129 case 1u: |
| 130 EXPECT_TRUE(DrawConstraintsEquals(constraints, new_constraints_)); | 130 EXPECT_TRUE(DrawConstraintsEquals(constraints, new_constraints_)); |
| 131 break; | 131 break; |
| 132 case 3u: | 132 case 3u: |
| 133 EXPECT_TRUE(DrawConstraintsEquals(constraints, initial_constraints_)); | 133 EXPECT_TRUE(DrawConstraintsEquals(constraints, initial_constraints_)); |
| 134 EndTest(); | 134 EndTest(); |
| 135 break; | 135 break; |
| 136 // There will be a following 4th onDraw. But the hardware renderer won't | 136 // There will be a following 4th onDraw. But the hardware renderer won't |
| (...skipping 140 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 277 | 277 |
| 278 private: | 278 private: |
| 279 std::queue<content::SynchronousCompositor::Frame> frames_; | 279 std::queue<content::SynchronousCompositor::Frame> frames_; |
| 280 uint32_t last_output_surface_id_; | 280 uint32_t last_output_surface_id_; |
| 281 std::map<cc::ResourceId, int> expected_return_count_; | 281 std::map<cc::ResourceId, int> expected_return_count_; |
| 282 }; | 282 }; |
| 283 | 283 |
| 284 RENDERING_TEST_F(SwitchOutputSurfaceIdTest); | 284 RENDERING_TEST_F(SwitchOutputSurfaceIdTest); |
| 285 | 285 |
| 286 } // namespace android_webview | 286 } // namespace android_webview |
| OLD | NEW |