OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <stdint.h> | 5 #include <stdint.h> |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 | 8 |
9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "media/base/test_random.h" |
10 #include "media/blink/interval_map.h" | 11 #include "media/blink/interval_map.h" |
11 #include "media/blink/test_random.h" | |
12 #include "testing/gtest/include/gtest/gtest.h" | 12 #include "testing/gtest/include/gtest/gtest.h" |
13 | 13 |
14 namespace { | 14 namespace { |
15 | 15 |
16 // Our tests only modifiy the interval map entries in [0..kTestSize). | 16 // Our tests only modifiy the interval map entries in [0..kTestSize). |
17 // We need this to be big enough to hit tricky corner cases, but small | 17 // We need this to be big enough to hit tricky corner cases, but small |
18 // enough that we get lots of entry duplication to clean up. | 18 // enough that we get lots of entry duplication to clean up. |
19 // Also, SimpleIntervalMap uses a vector of size kTestSize to emulate | 19 // Also, SimpleIntervalMap uses a vector of size kTestSize to emulate |
20 // a intervalmap, so making this too big will the test down a lot. | 20 // a intervalmap, so making this too big will the test down a lot. |
21 const int kTestSize = 16; | 21 const int kTestSize = 16; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
263 for (int i = 0; i < 200; i++) { | 263 for (int i = 0; i < 200; i++) { |
264 int32_t begin = rnd_.Rand() % (kTestSize - 1); | 264 int32_t begin = rnd_.Rand() % (kTestSize - 1); |
265 int32_t end = begin + 1 + rnd_.Rand() % (kTestSize - begin - 1); | 265 int32_t end = begin + 1 + rnd_.Rand() % (kTestSize - begin - 1); |
266 SetInterval(begin, end, rnd_.Rand() & 3); | 266 SetInterval(begin, end, rnd_.Rand() & 3); |
267 if (HasFailure()) { | 267 if (HasFailure()) { |
268 return; | 268 return; |
269 } | 269 } |
270 } | 270 } |
271 } | 271 } |
272 } | 272 } |
OLD | NEW |