OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 <set> | 5 #include <set> |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/strings/string_number_conversions.h" | 8 #include "base/strings/string_number_conversions.h" |
9 #include "chrome/browser/extensions/extension_browsertest.h" | 9 #include "chrome/browser/extensions/extension_browsertest.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
11 #include "chrome/browser/extensions/extension_storage_monitor.h" | 11 #include "chrome/browser/extensions/extension_storage_monitor.h" |
| 12 #include "chrome/browser/ui/extensions/app_launch_params.h" |
12 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
13 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
14 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
15 #include "extensions/browser/extension_registry.h" | 16 #include "extensions/browser/extension_registry.h" |
16 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
17 #include "extensions/browser/test_extension_registry_observer.h" | 18 #include "extensions/browser/test_extension_registry_observer.h" |
| 19 #include "extensions/common/constants.h" |
18 #include "extensions/test/extension_test_message_listener.h" | 20 #include "extensions/test/extension_test_message_listener.h" |
19 #include "ui/message_center/message_center.h" | 21 #include "ui/message_center/message_center.h" |
20 #include "ui/message_center/message_center_observer.h" | 22 #include "ui/message_center/message_center_observer.h" |
21 | 23 |
22 namespace extensions { | 24 namespace extensions { |
23 | 25 |
24 namespace { | 26 namespace { |
25 | 27 |
26 const int kInitialUsageThreshold = 500; | 28 const int kInitialUsageThreshold = 500; |
27 | 29 |
(...skipping 144 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 // Write a number of bytes to persistent storage. | 174 // Write a number of bytes to persistent storage. |
173 void WriteBytes(const Extension* extension, | 175 void WriteBytes(const Extension* extension, |
174 int num_bytes, | 176 int num_bytes, |
175 bool expected_notification) { | 177 bool expected_notification) { |
176 ExtensionTestMessageListener launched_listener("launched", true); | 178 ExtensionTestMessageListener launched_listener("launched", true); |
177 ExtensionTestMessageListener write_complete_listener( | 179 ExtensionTestMessageListener write_complete_listener( |
178 "write_complete", false); | 180 "write_complete", false); |
179 NotificationObserver notification_observer( | 181 NotificationObserver notification_observer( |
180 GetNotificationId(extension->id())); | 182 GetNotificationId(extension->id())); |
181 | 183 |
182 OpenApplication(AppLaunchParams( | 184 OpenApplication(AppLaunchParams(profile(), extension, LAUNCH_CONTAINER_NONE, |
183 profile(), extension, LAUNCH_CONTAINER_NONE, NEW_WINDOW)); | 185 NEW_WINDOW, extensions::SOURCE_UNTRACKED)); |
184 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); | 186 ASSERT_TRUE(launched_listener.WaitUntilSatisfied()); |
185 | 187 |
186 // Instruct the app to write |num_bytes| of data. | 188 // Instruct the app to write |num_bytes| of data. |
187 launched_listener.Reply(base::IntToString(num_bytes)); | 189 launched_listener.Reply(base::IntToString(num_bytes)); |
188 ASSERT_TRUE(write_complete_listener.WaitUntilSatisfied()); | 190 ASSERT_TRUE(write_complete_listener.WaitUntilSatisfied()); |
189 | 191 |
190 if (expected_notification) { | 192 if (expected_notification) { |
191 EXPECT_TRUE(notification_observer.WaitForNotification()); | 193 EXPECT_TRUE(notification_observer.WaitForNotification()); |
192 } else { | 194 } else { |
193 base::RunLoop().RunUntilIdle(); | 195 base::RunLoop().RunUntilIdle(); |
(...skipping 137 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
331 ExtensionStorageMonitor::BUTTON_UNINSTALL); | 333 ExtensionStorageMonitor::BUTTON_UNINSTALL); |
332 | 334 |
333 // Also fake accepting the uninstall. | 335 // Also fake accepting the uninstall. |
334 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), | 336 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), |
335 extension->id()); | 337 extension->id()); |
336 SimulateUninstallDialogAccept(); | 338 SimulateUninstallDialogAccept(); |
337 observer.WaitForExtensionUninstalled(); | 339 observer.WaitForExtensionUninstalled(); |
338 } | 340 } |
339 | 341 |
340 } // namespace extensions | 342 } // namespace extensions |
OLD | NEW |