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" |
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
53 | 53 |
54 waiting_ = true; | 54 waiting_ = true; |
55 content::RunMessageLoop(); | 55 content::RunMessageLoop(); |
56 waiting_ = false; | 56 waiting_ = false; |
57 return HasReceivedNotification(); | 57 return HasReceivedNotification(); |
58 } | 58 } |
59 | 59 |
60 private: | 60 private: |
61 // MessageCenterObserver implementation: | 61 // MessageCenterObserver implementation: |
62 virtual void OnNotificationAdded( | 62 virtual void OnNotificationAdded( |
63 const std::string& notification_id) OVERRIDE { | 63 const std::string& notification_id) override { |
64 received_notifications_.insert(notification_id); | 64 received_notifications_.insert(notification_id); |
65 | 65 |
66 if (waiting_ && HasReceivedNotification()) | 66 if (waiting_ && HasReceivedNotification()) |
67 base::MessageLoopForUI::current()->Quit(); | 67 base::MessageLoopForUI::current()->Quit(); |
68 } | 68 } |
69 | 69 |
70 message_center::MessageCenter* message_center_; | 70 message_center::MessageCenter* message_center_; |
71 std::set<std::string> received_notifications_; | 71 std::set<std::string> received_notifications_; |
72 std::string target_notification_id_; | 72 std::string target_notification_id_; |
73 bool waiting_; | 73 bool waiting_; |
74 }; | 74 }; |
75 | 75 |
76 } // namespace | 76 } // namespace |
77 | 77 |
78 class ExtensionStorageMonitorTest : public ExtensionBrowserTest { | 78 class ExtensionStorageMonitorTest : public ExtensionBrowserTest { |
79 public: | 79 public: |
80 ExtensionStorageMonitorTest() : storage_monitor_(NULL) {} | 80 ExtensionStorageMonitorTest() : storage_monitor_(NULL) {} |
81 | 81 |
82 protected: | 82 protected: |
83 // ExtensionBrowserTest overrides: | 83 // ExtensionBrowserTest overrides: |
84 virtual void SetUpOnMainThread() OVERRIDE { | 84 virtual void SetUpOnMainThread() override { |
85 ExtensionBrowserTest::SetUpOnMainThread(); | 85 ExtensionBrowserTest::SetUpOnMainThread(); |
86 | 86 |
87 InitStorageMonitor(); | 87 InitStorageMonitor(); |
88 } | 88 } |
89 | 89 |
90 ExtensionStorageMonitor* monitor() { | 90 ExtensionStorageMonitor* monitor() { |
91 CHECK(storage_monitor_); | 91 CHECK(storage_monitor_); |
92 return storage_monitor_; | 92 return storage_monitor_; |
93 } | 93 } |
94 | 94 |
(...skipping 239 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
334 ExtensionStorageMonitor::BUTTON_UNINSTALL); | 334 ExtensionStorageMonitor::BUTTON_UNINSTALL); |
335 | 335 |
336 // Also fake accepting the uninstall. | 336 // Also fake accepting the uninstall. |
337 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), | 337 TestExtensionRegistryObserver observer(ExtensionRegistry::Get(profile()), |
338 extension->id()); | 338 extension->id()); |
339 SimulateUninstallDialogAccept(); | 339 SimulateUninstallDialogAccept(); |
340 observer.WaitForExtensionUninstalled(); | 340 observer.WaitForExtensionUninstalled(); |
341 } | 341 } |
342 | 342 |
343 } // namespace extensions | 343 } // namespace extensions |
OLD | NEW |