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

Side by Side Diff: media/capture/content/smooth_event_sampler_unittest.cc

Issue 1534273002: Switch to standard integer types in media/. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: more Created 5 years 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
OLDNEW
1 // Copyright (c) 2015 The Chromium Authors. All rights reserved. 1 // Copyright (c) 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 "media/capture/content/smooth_event_sampler.h" 5 #include "media/capture/content/smooth_event_sampler.h"
6 6
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "testing/gtest/include/gtest/gtest.h" 8 #include "testing/gtest/include/gtest/gtest.h"
9 9
10 namespace media { 10 namespace media {
(...skipping 350 matching lines...) Expand 10 before | Expand all | Expand 10 after
361 bool should_capture; 361 bool should_capture;
362 double increment_ms; 362 double increment_ms;
363 }; 363 };
364 364
365 void ReplayCheckingSamplerDecisions(const DataPoint* data_points, 365 void ReplayCheckingSamplerDecisions(const DataPoint* data_points,
366 size_t num_data_points, 366 size_t num_data_points,
367 SmoothEventSampler* sampler) { 367 SmoothEventSampler* sampler) {
368 base::TimeTicks t = InitialTestTimeTicks(); 368 base::TimeTicks t = InitialTestTimeTicks();
369 for (size_t i = 0; i < num_data_points; ++i) { 369 for (size_t i = 0; i < num_data_points; ++i) {
370 t += base::TimeDelta::FromMicroseconds( 370 t += base::TimeDelta::FromMicroseconds(
371 static_cast<int64>(data_points[i].increment_ms * 1000)); 371 static_cast<int64_t>(data_points[i].increment_ms * 1000));
372 ASSERT_EQ(data_points[i].should_capture, 372 ASSERT_EQ(data_points[i].should_capture,
373 AddEventAndConsiderSampling(sampler, t)) 373 AddEventAndConsiderSampling(sampler, t))
374 << "at data_points[" << i << ']'; 374 << "at data_points[" << i << ']';
375 if (data_points[i].should_capture) 375 if (data_points[i].should_capture)
376 sampler->RecordSample(); 376 sampler->RecordSample();
377 } 377 }
378 } 378 }
379 379
380 } // namespace 380 } // namespace
381 381
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
695 {true, 33.441}, 695 {true, 33.441},
696 {false, 16.72}, 696 {false, 16.72},
697 {true, 16.72}, 697 {true, 16.72},
698 {true, 50.16}}; 698 {true, 50.16}};
699 699
700 SmoothEventSampler sampler(base::TimeDelta::FromSeconds(1) / 30, 3); 700 SmoothEventSampler sampler(base::TimeDelta::FromSeconds(1) / 30, 3);
701 ReplayCheckingSamplerDecisions(data_points, arraysize(data_points), &sampler); 701 ReplayCheckingSamplerDecisions(data_points, arraysize(data_points), &sampler);
702 } 702 }
703 703
704 } // namespace media 704 } // namespace media
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698