| 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 97 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 108 iter != errors->end(); ++iter) { | 108 iter != errors->end(); ++iter) { |
| 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) { |
| 119 NotificationRegistrar registrar; |
| 120 registrar.Add(this, NotificationType::EXTENSION_LOADED, |
| 121 NotificationService::AllSources()); |
| 122 |
| 123 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 124 service->ReloadExtension(extension_id); |
| 125 MessageLoop::current()->PostDelayedTask( |
| 126 FROM_HERE, new MessageLoop::QuitTask, kTimeoutMs); |
| 127 ui_test_utils::RunMessageLoop(); |
| 128 } |
| 129 |
| 118 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { | 130 void ExtensionBrowserTest::UnloadExtension(const std::string& extension_id) { |
| 119 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 131 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 120 service->UnloadExtension(extension_id); | 132 service->UnloadExtension(extension_id); |
| 121 } | 133 } |
| 122 | 134 |
| 123 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { | 135 void ExtensionBrowserTest::UninstallExtension(const std::string& extension_id) { |
| 124 ExtensionsService* service = browser()->profile()->GetExtensionsService(); | 136 ExtensionsService* service = browser()->profile()->GetExtensionsService(); |
| 125 service->UninstallExtension(extension_id, false); | 137 service->UninstallExtension(extension_id, false); |
| 126 } | 138 } |
| 127 | 139 |
| (...skipping 109 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 237 case NotificationType::EXTENSION_INSTALL_ERROR: | 249 case NotificationType::EXTENSION_INSTALL_ERROR: |
| 238 std::cout << "Got EXTENSION_INSTALL_ERROR notification.\n"; | 250 std::cout << "Got EXTENSION_INSTALL_ERROR notification.\n"; |
| 239 MessageLoopForUI::current()->Quit(); | 251 MessageLoopForUI::current()->Quit(); |
| 240 break; | 252 break; |
| 241 | 253 |
| 242 default: | 254 default: |
| 243 NOTREACHED(); | 255 NOTREACHED(); |
| 244 break; | 256 break; |
| 245 } | 257 } |
| 246 } | 258 } |
| OLD | NEW |