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/extensions/extension_test_message_listener.h" | 12 #include "chrome/browser/extensions/extension_test_message_listener.h" |
13 #include "chrome/browser/ui/extensions/application_launch.h" | 13 #include "chrome/browser/ui/extensions/application_launch.h" |
14 #include "content/public/test/test_utils.h" | 14 #include "content/public/test/test_utils.h" |
15 #include "extensions/browser/extension_prefs.h" | 15 #include "extensions/browser/extension_prefs.h" |
16 #include "extensions/browser/extension_registry.h" | |
16 #include "extensions/browser/extension_system.h" | 17 #include "extensions/browser/extension_system.h" |
18 #include "extensions/browser/test_extension_registry_observer.h" | |
17 #include "ui/message_center/message_center.h" | 19 #include "ui/message_center/message_center.h" |
18 #include "ui/message_center/message_center_observer.h" | 20 #include "ui/message_center/message_center_observer.h" |
19 | 21 |
20 namespace extensions { | 22 namespace extensions { |
21 | 23 |
22 namespace { | 24 namespace { |
23 | 25 |
24 const int kInitialUsageThreshold = 500; | 26 const int kInitialUsageThreshold = 500; |
25 | 27 |
26 const char kWriteDataApp[] = "storage_monitor/write_data"; | 28 const char kWriteDataApp[] = "storage_monitor/write_data"; |
(...skipping 298 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
325 const Extension* extension = InitWriteDataApp(); | 327 const Extension* extension = InitWriteDataApp(); |
326 ASSERT_TRUE(extension); | 328 ASSERT_TRUE(extension); |
327 WriteBytesExpectingNotification(extension, GetInitialExtensionThreshold()); | 329 WriteBytesExpectingNotification(extension, GetInitialExtensionThreshold()); |
328 | 330 |
329 // Fake clicking the notification button to uninstall. | 331 // Fake clicking the notification button to uninstall. |
330 message_center::MessageCenter::Get()->ClickOnNotificationButton( | 332 message_center::MessageCenter::Get()->ClickOnNotificationButton( |
331 GetNotificationId(extension->id()), | 333 GetNotificationId(extension->id()), |
332 ExtensionStorageMonitor::BUTTON_UNINSTALL); | 334 ExtensionStorageMonitor::BUTTON_UNINSTALL); |
333 | 335 |
334 // Also fake accepting the uninstall. | 336 // Also fake accepting the uninstall. |
335 content::WindowedNotificationObserver uninstalled_signal( | 337 extensions::TestExtensionRegistryObserver observer( |
336 chrome::NOTIFICATION_EXTENSION_UNINSTALLED_DEPRECATED, | 338 extensions::ExtensionRegistry::Get(profile())); |
337 content::Source<Profile>(profile())); | |
338 SimulateUninstallDialogAccept(); | 339 SimulateUninstallDialogAccept(); |
339 uninstalled_signal.Wait(); | 340 observer.WaitForExtensionUninstalled(extension->id()); |
Yoyo Zhou
2014/06/17 18:15:37
You should copy extension->id() into a temporary s
limasdf
2014/06/19 18:06:28
Pass to the contructor.
| |
340 } | 341 } |
341 | 342 |
342 } // namespace extensions | 343 } // namespace extensions |
OLD | NEW |