Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(410)

Side by Side Diff: remoting/host/differ_block_unittest.cc

Issue 2690003: Copy the (early prototype of) remoting in Chrome into the public tree.... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « remoting/host/differ_block.cc ('k') | remoting/host/encoder.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Property Changes:
Added: svn:eol-style
+ LF
OLDNEW
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "media/base/data_buffer.h"
6 #include "remoting/host/differ_block.h"
7 #include "testing/gmock/include/gmock/gmock.h"
8
9 namespace remoting {
10
11 static const int kWidth = 32;
12 static const int kHeight = 32;
13 static const int kBytesPerPixel = 3;
14
15 static void GenerateData(uint8* data, int size) {
16 for (int i = 0; i < size; ++i) {
17 data[i] = i;
18 }
19 }
20
21 class EncodeDoneHandler
22 : public base::RefCountedThreadSafe<EncodeDoneHandler> {
23 public:
24 MOCK_METHOD0(EncodeDone, void());
25 };
26
27 TEST(BlockDifferenceTest, BlockDifference) {
28 // Prepare 2 blocks to compare.
29 uint8 block1[kHeight * kWidth * kBytesPerPixel];
30 uint8 block2[kHeight * kWidth * kBytesPerPixel];
31 GenerateData(block1, sizeof(block1));
32 memcpy(block2, block1, sizeof(block2));
33
34 // These blocks should match.
35 int same = BlockDifference(block1, block2, kWidth * kBytesPerPixel);
36 EXPECT_EQ(0, same);
37
38 // Change block2 a little.
39 block2[7] += 3;
40 block2[sizeof(block2)-1] -= 5;
41 // These blocks should not match. The difference should be 8.
42 int not_same = BlockDifference(block1, block2, kWidth * kBytesPerPixel);
43 EXPECT_EQ(8, not_same);
44 }
45
46 } // namespace remoting
OLDNEW
« no previous file with comments | « remoting/host/differ_block.cc ('k') | remoting/host/encoder.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698