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_proxy.h" | 6 #include "base/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/gpu_data_manager_impl.h" | 9 #include "content/browser/gpu/gpu_data_manager_impl.h" |
10 #include "content/browser/renderer_host/render_widget_host_impl.h" | 10 #include "content/browser/renderer_host/render_widget_host_impl.h" |
(...skipping 152 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
163 // Waits until the source is available for copying. | 163 // Waits until the source is available for copying. |
164 void WaitForCopySourceReady() { | 164 void WaitForCopySourceReady() { |
165 while (!GetRenderWidgetHostViewPort()->IsSurfaceAvailableForCopy()) | 165 while (!GetRenderWidgetHostViewPort()->IsSurfaceAvailableForCopy()) |
166 GiveItSomeTime(); | 166 GiveItSomeTime(); |
167 } | 167 } |
168 | 168 |
169 // Run the current message loop for a short time without unwinding the current | 169 // Run the current message loop for a short time without unwinding the current |
170 // call stack. | 170 // call stack. |
171 static void GiveItSomeTime() { | 171 static void GiveItSomeTime() { |
172 base::RunLoop run_loop; | 172 base::RunLoop run_loop; |
173 MessageLoop::current()->PostDelayedTask( | 173 base::MessageLoop::current()->PostDelayedTask( |
174 FROM_HERE, | 174 FROM_HERE, |
175 run_loop.QuitClosure(), | 175 run_loop.QuitClosure(), |
176 base::TimeDelta::FromMilliseconds(10)); | 176 base::TimeDelta::FromMilliseconds(10)); |
177 run_loop.Run(); | 177 run_loop.Run(); |
178 } | 178 } |
179 | 179 |
180 private: | 180 private: |
181 const gfx::Size frame_size_; | 181 const gfx::Size frame_size_; |
182 base::FilePath test_dir_; | 182 base::FilePath test_dir_; |
183 int callback_invoke_count_; | 183 int callback_invoke_count_; |
(...skipping 229 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 run_loop.Run(); | 413 run_loop.Run(); |
414 | 414 |
415 EXPECT_EQ(2, callback_invoke_count()); | 415 EXPECT_EQ(2, callback_invoke_count()); |
416 EXPECT_EQ(2, frames_captured()); | 416 EXPECT_EQ(2, frames_captured()); |
417 } | 417 } |
418 | 418 |
419 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) | 419 #endif // !defined(OS_ANDROID) && !defined(OS_IOS) |
420 | 420 |
421 } // namespace | 421 } // namespace |
422 } // namespace content | 422 } // namespace content |
OLD | NEW |