| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 <algorithm> | 5 #include <algorithm> |
| 6 | 6 |
| 7 #include "base/rand_util.h" | 7 #include "base/rand_util.h" |
| 8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
| 9 #include "base/time/time.h" | 9 #include "base/time/time.h" |
| 10 #include "chrome/browser/apps/ephemeral_app_service.h" | 10 #include "chrome/browser/apps/ephemeral_app_service.h" |
| (...skipping 19 matching lines...) Expand all Loading... |
| 30 return generated_time; | 30 return generated_time; |
| 31 } | 31 } |
| 32 | 32 |
| 33 } // namespace | 33 } // namespace |
| 34 | 34 |
| 35 class EphemeralAppServiceTest : public testing::Test { | 35 class EphemeralAppServiceTest : public testing::Test { |
| 36 protected: | 36 protected: |
| 37 typedef EphemeralAppService::LaunchTimeAppMap LaunchTimeAppMap; | 37 typedef EphemeralAppService::LaunchTimeAppMap LaunchTimeAppMap; |
| 38 | 38 |
| 39 EphemeralAppServiceTest() {} | 39 EphemeralAppServiceTest() {} |
| 40 virtual ~EphemeralAppServiceTest() {} | 40 ~EphemeralAppServiceTest() override {} |
| 41 | 41 |
| 42 void RunTest(int ephemeral_app_count, | 42 void RunTest(int ephemeral_app_count, |
| 43 const LaunchTimeAppMap& launch_times, | 43 const LaunchTimeAppMap& launch_times, |
| 44 const std::set<std::string>& expected_removed_ids) { | 44 const std::set<std::string>& expected_removed_ids) { |
| 45 std::set<std::string> remove_app_ids; | 45 std::set<std::string> remove_app_ids; |
| 46 EphemeralAppService::GetAppsToRemove(ephemeral_app_count, | 46 EphemeralAppService::GetAppsToRemove(ephemeral_app_count, |
| 47 launch_times, | 47 launch_times, |
| 48 &remove_app_ids); | 48 &remove_app_ids); |
| 49 EXPECT_EQ(expected_removed_ids, remove_app_ids); | 49 EXPECT_EQ(expected_removed_ids, remove_app_ids); |
| 50 } | 50 } |
| (...skipping 206 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 257 const int kRunningApps = 3; | 257 const int kRunningApps = 3; |
| 258 AddIntermediateApps( | 258 AddIntermediateApps( |
| 259 time_now, | 259 time_now, |
| 260 EphemeralAppService::kMaxEphemeralAppsCount, | 260 EphemeralAppService::kMaxEphemeralAppsCount, |
| 261 &launch_times); // overflow | 261 &launch_times); // overflow |
| 262 RunTestCheckLRU( | 262 RunTestCheckLRU( |
| 263 launch_times.size() + kRunningApps, | 263 launch_times.size() + kRunningApps, |
| 264 launch_times, | 264 launch_times, |
| 265 kRunningApps); | 265 kRunningApps); |
| 266 } | 266 } |
| OLD | NEW |