Merge "Address review comments and sync branches"

This commit is contained in:
TreeHugger Robot
2020-02-07 23:27:36 +00:00
committed by Android (Google) Code Review
2 changed files with 41 additions and 29 deletions

View File

@@ -827,7 +827,7 @@ class RenewalTest : public ODKTimerTest {
if (cutoff > 0) ASSERT_LE(stop, cutoff);
// We'll fake instantaneous renewal requests. Flight time not important.
clock_values_.time_of_renewal_request = start;
OEMCryptoResult result = ODK_ComputeRenewalDuration(
const OEMCryptoResult result = ODK_ComputeRenewalDuration(
&timer_limits_, &clock_values_, start, renewal_duration_seconds,
timer_value_pointer);
// After first playback, the license is active.
@@ -899,7 +899,7 @@ class RenewalTest : public ODKTimerTest {
// We'll fake instantaneous renewal requests. Flight time not important.
clock_values_.time_of_renewal_request = start;
uint64_t timer_value;
OEMCryptoResult result =
const OEMCryptoResult result =
ODK_ComputeRenewalDuration(&timer_limits_, &clock_values_, start,
renewal_duration_seconds, &timer_value);
EXPECT_EQ(clock_values_.time_when_timer_expires, cutoff);
@@ -1062,9 +1062,9 @@ TEST_P(ODKUseCase_LicenseWithRenewal, Case5) {
next_renewal, // stop: expect play allowed.
next_renewal + kGracePeriod, // cutoff: when timer expires.
timer_limits_.initial_renewal_duration_seconds);
} while (next_renewal + renewal_interval_ + kGracePeriod <
} while ((next_renewal + renewal_interval_ + kGracePeriod) <
playback_end_restriction());
// Attemt playing beyond the playback window.
// Attempt playing beyond the playback window.
const uint64_t current_renewal = next_renewal;
next_renewal = current_renewal + renewal_interval_;
RenewAndTerminate(current_renewal, // start: when renewal is loaded.
@@ -1087,7 +1087,7 @@ TEST_P(ODKUseCase_LicenseWithRenewal, Case6) {
renewal_interval_ += 100;
} while (next_renewal + renewal_interval_ + kGracePeriod <
playback_end_restriction());
// Attemt playing beyond the playback window:
// Attempt playing beyond the playback window:
const uint64_t current_renewal = next_renewal;
next_renewal = current_renewal + renewal_interval_;
RenewAndTerminate(current_renewal, // start: when renewal is loaded.
@@ -1171,7 +1171,6 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case1) {
// Playback started after rental duration.
TEST_F(ODKUseCase_LimitedDurationLicense, Case2) {
start_of_playback_ = EndOfRentalWindow() + 1;
EXPECT_NEAR(start_of_playback_, GetSystemTime(150), 5);
ForbidPlayback(start_of_playback_);
}
@@ -1181,7 +1180,8 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case3) {
LoadAndTerminatePlayback(start_of_playback_, time_of_renewal_ + kGracePeriod);
}
// Playback started within rental window and continues.
// Playback started within rental window, renewal is received, and playback
// continues.
TEST_F(ODKUseCase_LimitedDurationLicense, Case4) {
// Allow playback within the initial renewal window.
LoadAndAllowPlayback(start_of_playback_, time_of_renewal_,
@@ -1204,8 +1204,11 @@ TEST_F(ODKUseCase_LimitedDurationLicense, Case5) {
EndOfPlaybackWindow(), // cutoff: when timer expires.
renewal_duration);
uint64_t reload_time = play_for_one_hour + 100;
const uint64_t reload_time = play_for_one_hour + 100;
ReloadLicense(reload_time);
// Simulate reloading the license, and then reloading the renewal, and then
// restarting playback. That is allowed, and playback shall be terminated at
// the end of the original playback window.
RenewAndStart(reload_time, EndOfPlaybackWindow(), EndOfPlaybackWindow(),
renewal_duration);
// But not one second more.