OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 #include "media/cast/cast_defines.h" | 6 #include "media/cast/cast_defines.h" |
7 #include "media/cast/net/cast_transport_defines.h" | 7 #include "media/cast/net/cast_transport_defines.h" |
8 | 8 |
9 namespace media { | 9 namespace media { |
10 namespace cast { | 10 namespace cast { |
11 | 11 |
12 class FrameIdWrapHelperTest : public ::testing::Test { | 12 class FrameIdWrapHelperTest : public ::testing::Test { |
13 protected: | 13 protected: |
14 FrameIdWrapHelperTest() {} | 14 FrameIdWrapHelperTest() {} |
15 virtual ~FrameIdWrapHelperTest() {} | 15 ~FrameIdWrapHelperTest() override {} |
16 | 16 |
17 void RunOneTest(uint32 starting_point, int iterations) { | 17 void RunOneTest(uint32 starting_point, int iterations) { |
18 const int window_size = 127; | 18 const int window_size = 127; |
19 uint32 window_base = starting_point; | 19 uint32 window_base = starting_point; |
20 frame_id_wrap_helper_.largest_frame_id_seen_ = starting_point; | 20 frame_id_wrap_helper_.largest_frame_id_seen_ = starting_point; |
21 for (int i = 0; i < iterations; i++) { | 21 for (int i = 0; i < iterations; i++) { |
22 uint32 largest_frame_id_seen = | 22 uint32 largest_frame_id_seen = |
23 frame_id_wrap_helper_.largest_frame_id_seen_; | 23 frame_id_wrap_helper_.largest_frame_id_seen_; |
24 int offset = rand() % window_size; | 24 int offset = rand() % window_size; |
25 uint32 frame_id = window_base + offset; | 25 uint32 frame_id = window_base + offset; |
(...skipping 45 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
71 for (int i = 0; i < 50000 && !HasFailure(); i++) { | 71 for (int i = 0; i < 50000 && !HasFailure(); i++) { |
72 RunOneTest(i * 4711, 20); | 72 RunOneTest(i * 4711, 20); |
73 // Test wrap-around scenarios. | 73 // Test wrap-around scenarios. |
74 RunOneTest(0x7fffff00ul, 20); | 74 RunOneTest(0x7fffff00ul, 20); |
75 RunOneTest(0xffffff00ul, 20); | 75 RunOneTest(0xffffff00ul, 20); |
76 } | 76 } |
77 } | 77 } |
78 | 78 |
79 } // namespace cast | 79 } // namespace cast |
80 } // namespace media | 80 } // namespace media |
OLD | NEW |