| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 "base/command_line.h" | 5 #include "base/command_line.h" |
| 6 #include "base/message_loop/message_loop_proxy.h" | 6 #include "base/message_loop/message_loop_proxy.h" |
| 7 #include "base/path_service.h" | 7 #include "base/path_service.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "content/browser/gpu/compositor_util.h" | 9 #include "content/browser/gpu/compositor_util.h" |
| 10 #include "content/browser/gpu/gpu_data_manager_impl.h" | 10 #include "content/browser/gpu/gpu_data_manager_impl.h" |
| (...skipping 154 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 165 int count_attempts = 0; | 165 int count_attempts = 0; |
| 166 while (true) { | 166 while (true) { |
| 167 ++count_attempts; | 167 ++count_attempts; |
| 168 base::RunLoop run_loop; | 168 base::RunLoop run_loop; |
| 169 GetRenderViewHost()->CopyFromBackingStore( | 169 GetRenderViewHost()->CopyFromBackingStore( |
| 170 gfx::Rect(), | 170 gfx::Rect(), |
| 171 frame_size(), | 171 frame_size(), |
| 172 base::Bind( | 172 base::Bind( |
| 173 &RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, | 173 &RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, |
| 174 base::Unretained(this), | 174 base::Unretained(this), |
| 175 run_loop.QuitClosure())); | 175 run_loop.QuitClosure()), |
| 176 SkBitmap::kARGB_8888_Config); |
| 176 run_loop.Run(); | 177 run_loop.Run(); |
| 177 | 178 |
| 178 if (frames_captured()) | 179 if (frames_captured()) |
| 179 break; | 180 break; |
| 180 else | 181 else |
| 181 GiveItSomeTime(); | 182 GiveItSomeTime(); |
| 182 } | 183 } |
| 183 | 184 |
| 184 EXPECT_EQ(count_attempts, callback_invoke_count()); | 185 EXPECT_EQ(count_attempts, callback_invoke_count()); |
| 185 EXPECT_EQ(1, frames_captured()); | 186 EXPECT_EQ(1, frames_captured()); |
| (...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 369 // even when the RenderWidgetHost is deleting in the middle of an async copy. | 370 // even when the RenderWidgetHost is deleting in the middle of an async copy. |
| 370 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, | 371 IN_PROC_BROWSER_TEST_P(CompositingRenderWidgetHostViewBrowserTest, |
| 371 CopyFromBackingStore_CallbackDespiteDelete) { | 372 CopyFromBackingStore_CallbackDespiteDelete) { |
| 372 SET_UP_SURFACE_OR_PASS_TEST(NULL); | 373 SET_UP_SURFACE_OR_PASS_TEST(NULL); |
| 373 | 374 |
| 374 base::RunLoop run_loop; | 375 base::RunLoop run_loop; |
| 375 GetRenderViewHost()->CopyFromBackingStore( | 376 GetRenderViewHost()->CopyFromBackingStore( |
| 376 gfx::Rect(), | 377 gfx::Rect(), |
| 377 frame_size(), | 378 frame_size(), |
| 378 base::Bind(&RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, | 379 base::Bind(&RenderWidgetHostViewBrowserTest::FinishCopyFromBackingStore, |
| 379 base::Unretained(this), run_loop.QuitClosure())); | 380 base::Unretained(this), |
| 381 run_loop.QuitClosure()), |
| 382 SkBitmap::kARGB_8888_Config); |
| 380 // Delete the surface before the callback is run. | 383 // Delete the surface before the callback is run. |
| 381 GetRenderWidgetHostViewPort()->AcceleratedSurfaceRelease(); | 384 GetRenderWidgetHostViewPort()->AcceleratedSurfaceRelease(); |
| 382 run_loop.Run(); | 385 run_loop.Run(); |
| 383 | 386 |
| 384 EXPECT_EQ(1, callback_invoke_count()); | 387 EXPECT_EQ(1, callback_invoke_count()); |
| 385 } | 388 } |
| 386 | 389 |
| 387 // Tests that the callback passed to CopyFromCompositingSurfaceToVideoFrame is | 390 // Tests that the callback passed to CopyFromCompositingSurfaceToVideoFrame is |
| 388 // always called, even when the RenderWidgetHost is deleting in the middle of | 391 // always called, even when the RenderWidgetHost is deleting in the middle of |
| 389 // an async copy. | 392 // an async copy. |
| (...skipping 554 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 944 CompositingRenderWidgetHostViewBrowserTestTabCapture, | 947 CompositingRenderWidgetHostViewBrowserTestTabCapture, |
| 945 testing::ValuesIn(kAllCompositingModes)); | 948 testing::ValuesIn(kAllCompositingModes)); |
| 946 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, | 949 INSTANTIATE_TEST_CASE_P(GLAndSoftwareCompositing, |
| 947 CompositingRenderWidgetHostViewTabCaptureHighDPI, | 950 CompositingRenderWidgetHostViewTabCaptureHighDPI, |
| 948 testing::ValuesIn(kAllCompositingModes)); | 951 testing::ValuesIn(kAllCompositingModes)); |
| 949 | 952 |
| 950 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 953 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
| 951 | 954 |
| 952 } // namespace | 955 } // namespace |
| 953 } // namespace content | 956 } // namespace content |
| OLD | NEW |