OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 "chrome/browser/extensions/extension_browsertest.h" | 5 #include "chrome/browser/extensions/extension_browsertest.h" |
6 | 6 |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
109 std::cout << *iter << "\n"; | 109 std::cout << *iter << "\n"; |
110 } | 110 } |
111 | 111 |
112 return false; | 112 return false; |
113 } | 113 } |
114 | 114 |
115 return WaitForExtensionHostsToLoad(); | 115 return WaitForExtensionHostsToLoad(); |
116 } | 116 } |
117 | 117 |
118 void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) { | 118 void ExtensionBrowserTest::ReloadExtension(const std::string& extension_id) { |
119 NotificationRegistrar registrar; | |
120 registrar.Add(this, NotificationType::EXTENSION_LOADED, | |
121 NotificationService::AllSources()); | |
122 | |
123 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 119 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
124 service->ReloadExtension(extension_id); | 120 service->ReloadExtension(extension_id); |
125 MessageLoop::current()->PostDelayedTask( | 121 ui_test_utils::RegisterAndWait(NotificationType::EXTENSION_PROCESS_CREATED, |
126 FROM_HERE, new MessageLoop::QuitTask, kTimeoutMs); | 122 this, kTimeoutMs); |
127 ui_test_utils::RunMessageLoop(); | |
128 } | 123 } |
129 | 124 |
130 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { | 125 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { |
131 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 126 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
132 service->UnloadExtension(extension_id); | 127 service->UnloadExtension(extension_id); |
133 } | 128 } |
134 | 129 |
135 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { | 130 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { |
136 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 131 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
137 service->UninstallExtension(extension_id, false); | 132 service->UninstallExtension(extension_id, false); |
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
252 case NotificationType::EXTENSION_INSTALL_ERROR: | 247 case NotificationType::EXTENSION_INSTALL_ERROR: |
253 std::cout << "Got EXTENSION_INSTALL_ERROR notification.\n"; | 248 std::cout << "Got EXTENSION_INSTALL_ERROR notification.\n"; |
254 MessageLoopForUI::current()->Quit(); | 249 MessageLoopForUI::current()->Quit(); |
255 break; | 250 break; |
256 | 251 |
257 case NotificationType::EXTENSION_OVERINSTALL_ERROR: | 252 case NotificationType::EXTENSION_OVERINSTALL_ERROR: |
258 std::cout << "Got EXTENSION_OVERINSTALL_ERROR notification.\n"; | 253 std::cout << "Got EXTENSION_OVERINSTALL_ERROR notification.\n"; |
259 MessageLoopForUI::current()->Quit(); | 254 MessageLoopForUI::current()->Quit(); |
260 break; | 255 break; |
261 | 256 |
| 257 case NotificationType::EXTENSION_PROCESS_CREATED: |
| 258 std::cout << "Got EXTENSION_PROCESS_CREATED notification.\n"; |
| 259 MessageLoopForUI::current()->Quit(); |
| 260 break; |
| 261 |
262 default: | 262 default: |
263 NOTREACHED(); | 263 NOTREACHED(); |
264 break; | 264 break; |
265 } | 265 } |
266 } | 266 } |
OLD | NEW |