OLD | NEW |
---|---|
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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/memory/ref_counted.h" | 5 #include "base/memory/ref_counted.h" |
6 #include "remoting/host/differ_block.h" | 6 #include "remoting/capturer/differ_block.h" |
7 #include "testing/gmock/include/gmock/gmock.h" | 7 #include "testing/gmock/include/gmock/gmock.h" |
8 | 8 |
9 namespace remoting { | 9 namespace remoting { |
10 | 10 |
11 // Run 900 times to mimic 1280x720. | 11 // Run 900 times to mimic 1280x720. |
12 // TODO(fbarchard): Remove benchmark once performance is non-issue. | 12 // TODO(fbarchard): Remove benchmark once performance is non-issue. |
13 static const int kTimesToRun = 900; | 13 static const int kTimesToRun = 900; |
Wez
2012/12/11 05:23:18
We should follow up and move this out to a separat
| |
14 | 14 |
15 static void GenerateData(uint8* data, int size) { | 15 static void GenerateData(uint8* data, int size) { |
16 for (int i = 0; i < size; ++i) { | 16 for (int i = 0; i < size; ++i) { |
17 data[i] = i; | 17 data[i] = i; |
18 } | 18 } |
19 } | 19 } |
20 | 20 |
21 // Memory buffer large enough for 2 blocks aligned to 16 bytes. | 21 // Memory buffer large enough for 2 blocks aligned to 16 bytes. |
22 static const int kSizeOfBlock = kBlockSize * kBlockSize * kBytesPerPixel; | 22 static const int kSizeOfBlock = kBlockSize * kBlockSize * kBytesPerPixel; |
23 uint8 block_buffer[kSizeOfBlock * 2 + 16]; | 23 uint8 block_buffer[kSizeOfBlock * 2 + 16]; |
(...skipping 48 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
72 PrepareBuffers(block1, block2); | 72 PrepareBuffers(block1, block2); |
73 block2[0] += 1; | 73 block2[0] += 1; |
74 | 74 |
75 for (int i = 0; i < kTimesToRun; ++i) { | 75 for (int i = 0; i < kTimesToRun; ++i) { |
76 int result = BlockDifference(block1, block2, kBlockSize * kBytesPerPixel); | 76 int result = BlockDifference(block1, block2, kBlockSize * kBytesPerPixel); |
77 EXPECT_EQ(1, result); | 77 EXPECT_EQ(1, result); |
78 } | 78 } |
79 } | 79 } |
80 | 80 |
81 } // namespace remoting | 81 } // namespace remoting |
OLD | NEW |