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 <string> | 5 #include <string> |
6 | 6 |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
9 #include "base/strings/utf_string_conversions.h" | 9 #include "base/strings/utf_string_conversions.h" |
10 #include "content/child/child_process.h" | 10 #include "content/child/child_process.h" |
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 PPB_ImageData_Impl::ForTest())); | 90 PPB_ImageData_Impl::ForTest())); |
91 image->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 640, 360, true); | 91 image->Init(PP_IMAGEDATAFORMAT_BGRA_PREMUL, 640, 360, true); |
92 { | 92 { |
93 base::RunLoop run_loop; | 93 base::RunLoop run_loop; |
94 base::Closure quit_closure = run_loop.QuitClosure(); | 94 base::Closure quit_closure = run_loop.QuitClosure(); |
95 | 95 |
96 EXPECT_CALL(sink, OnVideoFrame()).WillOnce( | 96 EXPECT_CALL(sink, OnVideoFrame()).WillOnce( |
97 RunClosure(quit_closure)); | 97 RunClosure(quit_closure)); |
98 frame_writer.Run(image.get(), 10); | 98 frame_writer.Run(image.get(), 10); |
99 run_loop.Run(); | 99 run_loop.Run(); |
| 100 // Run all pending tasks to let the the test clean up before the test ends. |
| 101 // This is due to that |
| 102 // FrameWriterDelegate::FrameWriterDelegate::DeliverFrame use |
| 103 // PostTaskAndReply to the IO thread and expects the reply to process |
| 104 // on the main render thread to clean up its resources. However, the |
| 105 // QuitClosure above ends before that. |
| 106 base::MessageLoop::current()->RunUntilIdle(); |
100 } | 107 } |
101 EXPECT_EQ(1, sink.number_of_frames()); | 108 EXPECT_EQ(1, sink.number_of_frames()); |
102 native_track->RemoveSink(&sink); | 109 native_track->RemoveSink(&sink); |
103 } | 110 } |
104 | 111 |
105 } // namespace content | 112 } // namespace content |
OLD | NEW |