OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <stddef.h> | 5 #include <stddef.h> |
6 | 6 |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "build/build_config.h" | 8 #include "build/build_config.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 #include "content/public/browser/render_process_host.h" | 22 #include "content/public/browser/render_process_host.h" |
23 #include "content/public/browser/render_view_host.h" | 23 #include "content/public/browser/render_view_host.h" |
24 #include "content/public/browser/web_contents.h" | 24 #include "content/public/browser/web_contents.h" |
25 #include "content/public/common/result_codes.h" | 25 #include "content/public/common/result_codes.h" |
26 #include "content/public/common/url_constants.h" | 26 #include "content/public/common/url_constants.h" |
27 #include "extensions/browser/extension_host.h" | 27 #include "extensions/browser/extension_host.h" |
28 #include "extensions/browser/extension_registry.h" | 28 #include "extensions/browser/extension_registry.h" |
29 #include "extensions/browser/extension_system.h" | 29 #include "extensions/browser/extension_system.h" |
30 #include "extensions/browser/process_manager.h" | 30 #include "extensions/browser/process_manager.h" |
31 #include "extensions/browser/process_map.h" | 31 #include "extensions/browser/process_map.h" |
| 32 #include "extensions/browser/test_extension_registry_observer.h" |
32 #include "extensions/common/constants.h" | 33 #include "extensions/common/constants.h" |
| 34 #include "extensions/test/background_page_watcher.cc" |
33 #include "ui/message_center/message_center.h" | 35 #include "ui/message_center/message_center.h" |
34 #include "ui/message_center/notification_list.h" | 36 #include "ui/message_center/notification_list.h" |
35 | 37 |
36 using content::NavigationController; | 38 using content::NavigationController; |
37 using content::WebContents; | 39 using content::WebContents; |
38 using extensions::Extension; | 40 using extensions::Extension; |
39 using extensions::ExtensionRegistry; | 41 using extensions::ExtensionRegistry; |
40 | 42 |
41 // Tests are timing out waiting for extension to crash. | 43 // Tests are timing out waiting for extension to crash. |
42 // http://crbug.com/174705 | 44 // http://crbug.com/174705 |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 protected: | 138 protected: |
137 void AcceptNotification(size_t index) override { | 139 void AcceptNotification(size_t index) override { |
138 message_center::MessageCenter* message_center = | 140 message_center::MessageCenter* message_center = |
139 message_center::MessageCenter::Get(); | 141 message_center::MessageCenter::Get(); |
140 ASSERT_GT(message_center->NotificationCount(), index); | 142 ASSERT_GT(message_center->NotificationCount(), index); |
141 message_center::NotificationList::Notifications::reverse_iterator it = | 143 message_center::NotificationList::Notifications::reverse_iterator it = |
142 message_center->GetVisibleNotifications().rbegin(); | 144 message_center->GetVisibleNotifications().rbegin(); |
143 for (size_t i = 0; i < index; ++i) | 145 for (size_t i = 0; i < index; ++i) |
144 ++it; | 146 ++it; |
145 std::string id = (*it)->id(); | 147 std::string id = (*it)->id(); |
| 148 extensions::TestExtensionRegistryObserver observer(GetExtensionRegistry()); |
146 message_center->ClickOnNotification(id); | 149 message_center->ClickOnNotification(id); |
147 WaitForExtensionLoad(); | 150 auto* extension = observer.WaitForExtensionLoaded(); |
| 151 extensions::BackgroundPageWatcher(GetProcessManager(), extension) |
| 152 .WaitForOpen(); |
148 } | 153 } |
149 | 154 |
150 void CancelNotification(size_t index) override { | 155 void CancelNotification(size_t index) override { |
151 message_center::MessageCenter* message_center = | 156 message_center::MessageCenter* message_center = |
152 message_center::MessageCenter::Get(); | 157 message_center::MessageCenter::Get(); |
153 ASSERT_GT(message_center->NotificationCount(), index); | 158 ASSERT_GT(message_center->NotificationCount(), index); |
154 message_center::NotificationList::Notifications::reverse_iterator it = | 159 message_center::NotificationList::Notifications::reverse_iterator it = |
155 message_center->GetVisibleNotifications().rbegin(); | 160 message_center->GetVisibleNotifications().rbegin(); |
156 for (size_t i = 0; i < index; ++i) | 161 for (size_t i = 0; i < index; ++i) |
157 ++it; | 162 ++it; |
(...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
557 GetController())); | 562 GetController())); |
558 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | 563 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
559 observer.Wait(); | 564 observer.Wait(); |
560 } | 565 } |
561 // Extension should now be loaded. | 566 // Extension should now be loaded. |
562 SCOPED_TRACE("after reloading the tab"); | 567 SCOPED_TRACE("after reloading the tab"); |
563 CheckExtensionConsistency(first_extension_id_); | 568 CheckExtensionConsistency(first_extension_id_); |
564 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 569 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
565 ASSERT_EQ(0U, CountBalloons()); | 570 ASSERT_EQ(0U, CountBalloons()); |
566 } | 571 } |
OLD | NEW |