| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 "media/base/data_buffer.h" | 5 #include "media/base/data_buffer.h" |
| 6 #include "remoting/base/pixel_format.h" | 6 #include "remoting/base/pixel_format.h" |
| 7 #include "remoting/host/encoder_vp8.h" | 7 #include "remoting/host/encoder_vp8.h" |
| 8 #include "testing/gmock/include/gmock/gmock.h" | 8 #include "testing/gmock/include/gmock/gmock.h" |
| 9 | 9 |
| 10 namespace remoting { | 10 namespace remoting { |
| (...skipping 29 matching lines...) Expand all Loading... |
| 40 | 40 |
| 41 uint8* planes[3]; | 41 uint8* planes[3]; |
| 42 planes[0] = new uint8[kWidth * kHeight]; | 42 planes[0] = new uint8[kWidth * kHeight]; |
| 43 planes[1] = new uint8[kWidth * kHeight / 4]; | 43 planes[1] = new uint8[kWidth * kHeight / 4]; |
| 44 planes[2] = new uint8[kWidth * kHeight / 4]; | 44 planes[2] = new uint8[kWidth * kHeight / 4]; |
| 45 GenerateData(planes[0], kWidth * kHeight); | 45 GenerateData(planes[0], kWidth * kHeight); |
| 46 GenerateData(planes[1], kWidth * kHeight / 4); | 46 GenerateData(planes[1], kWidth * kHeight / 4); |
| 47 GenerateData(planes[2], kWidth * kHeight / 4); | 47 GenerateData(planes[2], kWidth * kHeight / 4); |
| 48 | 48 |
| 49 scoped_refptr<EncodeDoneHandler> handler = new EncodeDoneHandler(); | 49 scoped_refptr<EncodeDoneHandler> handler = new EncodeDoneHandler(); |
| 50 chromotocol_pb::UpdateStreamPacketHeader* header | 50 UpdateStreamPacketHeader* header = new UpdateStreamPacketHeader(); |
| 51 = new chromotocol_pb::UpdateStreamPacketHeader(); | |
| 52 scoped_refptr<media::DataBuffer> encoded_data; | 51 scoped_refptr<media::DataBuffer> encoded_data; |
| 53 bool encode_done = false; | 52 bool encode_done = false; |
| 54 EXPECT_CALL(*handler, EncodeDone()); | 53 EXPECT_CALL(*handler, EncodeDone()); |
| 55 encoder.Encode(rects, const_cast<const uint8**>(planes), | 54 encoder.Encode(rects, const_cast<const uint8**>(planes), |
| 56 strides, true, header, &encoded_data, &encode_done, | 55 strides, true, header, &encoded_data, &encode_done, |
| 57 NewRunnableMethod(handler.get(), | 56 NewRunnableMethod(handler.get(), |
| 58 &EncodeDoneHandler::EncodeDone)); | 57 &EncodeDoneHandler::EncodeDone)); |
| 59 | 58 |
| 60 EXPECT_TRUE(encode_done); | 59 EXPECT_TRUE(encode_done); |
| 61 ASSERT_TRUE(encoded_data.get()); | 60 ASSERT_TRUE(encoded_data.get()); |
| 62 EXPECT_NE(0u, encoded_data->GetBufferSize()); | 61 EXPECT_NE(0u, encoded_data->GetBufferSize()); |
| 63 | 62 |
| 64 delete [] planes[0]; | 63 delete [] planes[0]; |
| 65 delete [] planes[1]; | 64 delete [] planes[1]; |
| 66 delete [] planes[2]; | 65 delete [] planes[2]; |
| 67 } | 66 } |
| 68 | 67 |
| 69 } // namespace remoting | 68 } // namespace remoting |
| OLD | NEW |