Chromium Code Reviews| 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" |
| 33 #include "ui/message_center/message_center.h" | 34 #include "ui/message_center/message_center.h" |
| 34 #include "ui/message_center/notification_list.h" | 35 #include "ui/message_center/notification_list.h" |
| 35 | 36 |
| 36 using content::NavigationController; | 37 using content::NavigationController; |
| 37 using content::WebContents; | 38 using content::WebContents; |
| 38 using extensions::Extension; | 39 using extensions::Extension; |
| 39 using extensions::ExtensionRegistry; | 40 using extensions::ExtensionRegistry; |
| 40 | 41 |
| 41 // Tests are timing out waiting for extension to crash. | 42 // Tests are timing out waiting for extension to crash. |
| (...skipping 94 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 136 protected: | 137 protected: |
| 137 void AcceptNotification(size_t index) override { | 138 void AcceptNotification(size_t index) override { |
| 138 message_center::MessageCenter* message_center = | 139 message_center::MessageCenter* message_center = |
| 139 message_center::MessageCenter::Get(); | 140 message_center::MessageCenter::Get(); |
| 140 ASSERT_GT(message_center->NotificationCount(), index); | 141 ASSERT_GT(message_center->NotificationCount(), index); |
| 141 message_center::NotificationList::Notifications::reverse_iterator it = | 142 message_center::NotificationList::Notifications::reverse_iterator it = |
| 142 message_center->GetVisibleNotifications().rbegin(); | 143 message_center->GetVisibleNotifications().rbegin(); |
| 143 for (size_t i = 0; i < index; ++i) | 144 for (size_t i = 0; i < index; ++i) |
| 144 ++it; | 145 ++it; |
| 145 std::string id = (*it)->id(); | 146 std::string id = (*it)->id(); |
| 147 extensions::TestExtensionRegistryObserver observer(GetExtensionRegistry()); | |
| 146 message_center->ClickOnNotification(id); | 148 message_center->ClickOnNotification(id); |
| 147 WaitForExtensionLoad(); | 149 observer.WaitForExtensionLoaded(); |
| 150 // Wait until extension's frame created. | |
| 151 base::RunLoop().RunUntilIdle(); | |
|
Devlin
2017/03/30 22:21:57
I think this is a little less deterministic than t
limasdf
2017/04/03 13:52:50
At the moment when WaitForExtensionViewsToloaded()
limasdf
2017/04/06 15:58:57
Done.
| |
| 148 } | 152 } |
| 149 | 153 |
| 150 void CancelNotification(size_t index) override { | 154 void CancelNotification(size_t index) override { |
| 151 message_center::MessageCenter* message_center = | 155 message_center::MessageCenter* message_center = |
| 152 message_center::MessageCenter::Get(); | 156 message_center::MessageCenter::Get(); |
| 153 ASSERT_GT(message_center->NotificationCount(), index); | 157 ASSERT_GT(message_center->NotificationCount(), index); |
| 154 message_center::NotificationList::Notifications::reverse_iterator it = | 158 message_center::NotificationList::Notifications::reverse_iterator it = |
| 155 message_center->GetVisibleNotifications().rbegin(); | 159 message_center->GetVisibleNotifications().rbegin(); |
| 156 for (size_t i = 0; i < index; ++i) | 160 for (size_t i = 0; i < index; ++i) |
| 157 ++it; | 161 ++it; |
| (...skipping 399 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 557 GetController())); | 561 GetController())); |
| 558 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); | 562 chrome::Reload(browser(), WindowOpenDisposition::CURRENT_TAB); |
| 559 observer.Wait(); | 563 observer.Wait(); |
| 560 } | 564 } |
| 561 // Extension should now be loaded. | 565 // Extension should now be loaded. |
| 562 SCOPED_TRACE("after reloading the tab"); | 566 SCOPED_TRACE("after reloading the tab"); |
| 563 CheckExtensionConsistency(first_extension_id_); | 567 CheckExtensionConsistency(first_extension_id_); |
| 564 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); | 568 ASSERT_EQ(count_before + 1, GetEnabledExtensionCount()); |
| 565 ASSERT_EQ(0U, CountBalloons()); | 569 ASSERT_EQ(0U, CountBalloons()); |
| 566 } | 570 } |
| OLD | NEW |