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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "chrome/browser/apps/ephemeral_app_browsertest.h" | 7 #include "chrome/browser/apps/ephemeral_app_browsertest.h" |
8 #include "chrome/browser/apps/ephemeral_app_service.h" | 8 #include "chrome/browser/apps/ephemeral_app_service.h" |
9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
10 #include "content/public/test/test_utils.h" | 10 #include "content/public/test/test_utils.h" |
11 #include "extensions/browser/extension_prefs.h" | 11 #include "extensions/browser/extension_prefs.h" |
12 #include "extensions/browser/extension_registry.h" | 12 #include "extensions/browser/extension_registry.h" |
| 13 #include "extensions/browser/notification_types.h" |
13 #include "extensions/common/manifest.h" | 14 #include "extensions/common/manifest.h" |
14 | 15 |
15 using extensions::Extension; | 16 using extensions::Extension; |
16 using extensions::ExtensionPrefs; | 17 using extensions::ExtensionPrefs; |
17 using extensions::ExtensionRegistry; | 18 using extensions::ExtensionRegistry; |
18 | 19 |
19 namespace { | 20 namespace { |
20 | 21 |
21 const int kNumTestApps = 2; | 22 const int kNumTestApps = 2; |
22 const char* kTestApps[] = { | 23 const char* kTestApps[] = { |
(...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
76 prefs->SetLastLaunchTime(inactive_app_id, inactive_launch); | 77 prefs->SetLastLaunchTime(inactive_app_id, inactive_launch); |
77 | 78 |
78 // Set launch time for an active app. | 79 // Set launch time for an active app. |
79 std::string active_app_id = app_ids_[1]; | 80 std::string active_app_id = app_ids_[1]; |
80 base::Time active_launch = time_now - | 81 base::Time active_launch = time_now - |
81 base::TimeDelta::FromDays(EphemeralAppService::kAppKeepThreshold); | 82 base::TimeDelta::FromDays(EphemeralAppService::kAppKeepThreshold); |
82 prefs->SetLastLaunchTime(active_app_id, active_launch); | 83 prefs->SetLastLaunchTime(active_app_id, active_launch); |
83 | 84 |
84 // Perform garbage collection. | 85 // Perform garbage collection. |
85 content::WindowedNotificationObserver uninstall_signal( | 86 content::WindowedNotificationObserver uninstall_signal( |
86 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, | 87 extensions::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, |
87 content::Source<Profile>(browser()->profile())); | 88 content::Source<Profile>(browser()->profile())); |
88 GarbageCollectEphemeralApps(); | 89 GarbageCollectEphemeralApps(); |
89 uninstall_signal.Wait(); | 90 uninstall_signal.Wait(); |
90 | 91 |
91 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 92 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
92 ASSERT_TRUE(registry); | 93 ASSERT_TRUE(registry); |
93 EXPECT_FALSE(registry->GetExtensionById(inactive_app_id, | 94 EXPECT_FALSE(registry->GetExtensionById(inactive_app_id, |
94 ExtensionRegistry::EVERYTHING)); | 95 ExtensionRegistry::EVERYTHING)); |
95 EXPECT_TRUE( | 96 EXPECT_TRUE( |
96 registry->GetExtensionById(active_app_id, ExtensionRegistry::EVERYTHING)); | 97 registry->GetExtensionById(active_app_id, ExtensionRegistry::EVERYTHING)); |
(...skipping 52 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
149 | 150 |
150 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); | 151 ExtensionRegistry* registry = ExtensionRegistry::Get(profile()); |
151 ASSERT_TRUE(registry); | 152 ASSERT_TRUE(registry); |
152 EXPECT_FALSE(registry->GetExtensionById(inactive_app_id, | 153 EXPECT_FALSE(registry->GetExtensionById(inactive_app_id, |
153 ExtensionRegistry::EVERYTHING)); | 154 ExtensionRegistry::EVERYTHING)); |
154 EXPECT_TRUE(registry->GetExtensionById(running_app_id, | 155 EXPECT_TRUE(registry->GetExtensionById(running_app_id, |
155 ExtensionRegistry::EVERYTHING)); | 156 ExtensionRegistry::EVERYTHING)); |
156 | 157 |
157 EXPECT_EQ(1, ephemeral_service->ephemeral_app_count()); | 158 EXPECT_EQ(1, ephemeral_service->ephemeral_app_count()); |
158 } | 159 } |
OLD | NEW |