summaryrefslogtreecommitdiff
path: root/chromium/media/base/android/media_service_throttler_unittest.cc
diff options
context:
space:
mode:
Diffstat (limited to 'chromium/media/base/android/media_service_throttler_unittest.cc')
-rw-r--r--chromium/media/base/android/media_service_throttler_unittest.cc31
1 files changed, 14 insertions, 17 deletions
diff --git a/chromium/media/base/android/media_service_throttler_unittest.cc b/chromium/media/base/android/media_service_throttler_unittest.cc
index af3b45a367e..554142b2358 100644
--- a/chromium/media/base/android/media_service_throttler_unittest.cc
+++ b/chromium/media/base/android/media_service_throttler_unittest.cc
@@ -140,11 +140,10 @@ TEST_F(MediaServiceThrottlerTest,
// reset.
TEST_F(MediaServiceThrottlerTest, NoCrash_LongInactivity_ShouldReset) {
// Schedule two minutes' worth of clients.
- SimulateClientCreations(
- base::ClampFloor(base::TimeDelta::FromMinutes(2) / base_delay_));
+ SimulateClientCreations(base::ClampFloor(base::Minutes(2) / base_delay_));
// Advance the time so the scheduler perceived a full minute of inactivity.
- clock_.Advance(base::TimeDelta::FromSeconds(61));
+ clock_.Advance(base::Seconds(61));
// Make sure new clients are burst scheduled.
EXPECT_EQ(base::TimeDelta(), throttler_->GetDelayForClientCreation());
@@ -172,7 +171,7 @@ TEST_F(MediaServiceThrottlerTest,
SimulateClientCreations(kMaxBurstClients);
SimulateCrashes(1);
- clock_.Advance(base::TimeDelta::FromMilliseconds(1));
+ clock_.Advance(base::Milliseconds(1));
// Because we use the floor function when calculating crashes, a small time
// advance should nullify a single crash.
@@ -185,7 +184,7 @@ TEST_F(MediaServiceThrottlerTest, WithCrash_ManyCrashes_DelayShouldIncrease) {
SimulateClientCreations(kMaxBurstClients);
SimulateCrashes(2);
- clock_.Advance(base::TimeDelta::FromMilliseconds(1));
+ clock_.Advance(base::Milliseconds(1));
// The delay after crashes should be greater than the base delay.
EXPECT_LT(base_delay_, GetCurrentDelayBetweenClients());
@@ -238,7 +237,7 @@ TEST_F(MediaServiceThrottlerTest, WithCrash_NoCrashesForAMinute_ShouldReset) {
// The effective server crash count should be reset because it has been over
// a minute since the last crash.
- clock_.Advance(base::TimeDelta::FromSeconds(61));
+ clock_.Advance(base::Seconds(61));
SimulateClientCreations(kMaxBurstClients);
@@ -250,9 +249,9 @@ TEST_F(MediaServiceThrottlerTest, WithCrash_ConstantCrashes_ShouldNotReset) {
SimulateCrashes(9);
// The effective server crash count should not be reset.
- clock_.Advance(base::TimeDelta::FromSeconds(59));
+ clock_.Advance(base::Seconds(59));
SimulateCrashes(1);
- clock_.Advance(base::TimeDelta::FromSeconds(2));
+ clock_.Advance(base::Seconds(2));
SimulateClientCreations(kMaxBurstClients);
@@ -265,11 +264,10 @@ TEST_F(MediaServiceThrottlerTest, CrashListener_NoRequests_ShouldShutDown) {
// Schedule many minutes worth of clients. This is to prove that the
// MediaServerCrashListener's clean up happens after lack of requests, as
// opposed to lack of actually scheduled clients.
- SimulateClientCreations(
- base::ClampFloor(base::TimeDelta::FromMinutes(3) / base_delay_));
+ SimulateClientCreations(base::ClampFloor(base::Minutes(3) / base_delay_));
// The MediaServerCrashListener should be alive, with 1s second to spare.
- clock_.Advance(base::TimeDelta::FromSeconds(59));
+ clock_.Advance(base::Seconds(59));
test_task_runner_->RunTasks();
EXPECT_TRUE(throttler_->IsCrashListenerAliveForTesting());
@@ -278,12 +276,12 @@ TEST_F(MediaServiceThrottlerTest, CrashListener_NoRequests_ShouldShutDown) {
throttler_->GetDelayForClientCreation();
// The MediaServerCrashListener should be alive, with 58s second to spare.
- clock_.Advance(base::TimeDelta::FromSeconds(2));
+ clock_.Advance(base::Seconds(2));
test_task_runner_->RunTasks();
EXPECT_TRUE(throttler_->IsCrashListenerAliveForTesting());
// The MediaServerCrashListener should be dead.
- clock_.Advance(base::TimeDelta::FromSeconds(59));
+ clock_.Advance(base::Seconds(59));
test_task_runner_->RunTasks();
EXPECT_FALSE(throttler_->IsCrashListenerAliveForTesting());
}
@@ -295,11 +293,10 @@ TEST_F(MediaServiceThrottlerTest,
// Schedule many minutes worth of clients. This is to prove that the
// MediaServerCrashListener's clean up happens after lack of requests, as
// opposed to lack of actually scheduled clients.
- SimulateClientCreations(
- base::ClampFloor(base::TimeDelta::FromMinutes(3) / base_delay_));
+ SimulateClientCreations(base::ClampFloor(base::Minutes(3) / base_delay_));
// The MediaServerCrashListener should be alive, with 1s second to spare.
- clock_.Advance(base::TimeDelta::FromSeconds(59));
+ clock_.Advance(base::Seconds(59));
test_task_runner_->RunTasks();
EXPECT_TRUE(throttler_->IsCrashListenerAliveForTesting());
@@ -307,7 +304,7 @@ TEST_F(MediaServiceThrottlerTest,
SimulateCrashes(1);
// The MediaServerCrashListener should be dead.
- clock_.Advance(base::TimeDelta::FromSeconds(2));
+ clock_.Advance(base::Seconds(2));
test_task_runner_->RunTasks();
EXPECT_FALSE(throttler_->IsCrashListenerAliveForTesting());
}