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 "base/bind.h" | 5 #include "base/bind.h" |
6 #include "base/cancelable_callback.h" | 6 #include "base/cancelable_callback.h" |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "base/compiler_specific.h" | 8 #include "base/compiler_specific.h" |
9 #include "base/memory/ref_counted.h" | 9 #include "base/memory/ref_counted.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 177 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
188 | 188 |
189 protected: | 189 protected: |
190 // Load an extension from test\data\devtools\extensions\<extension_name> | 190 // Load an extension from test\data\devtools\extensions\<extension_name> |
191 void LoadExtension(const char* extension_name) { | 191 void LoadExtension(const char* extension_name) { |
192 FilePath path = test_extensions_dir_.AppendASCII(extension_name); | 192 FilePath path = test_extensions_dir_.AppendASCII(extension_name); |
193 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; | 193 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; |
194 } | 194 } |
195 | 195 |
196 private: | 196 private: |
197 bool LoadExtensionFromPath(const FilePath& path) { | 197 bool LoadExtensionFromPath(const FilePath& path) { |
198 ExtensionService* service = browser()->profile()->GetExtensionService(); | 198 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 199 browser()->profile())->extension_service(); |
199 size_t num_before = service->extensions()->size(); | 200 size_t num_before = service->extensions()->size(); |
200 { | 201 { |
201 content::NotificationRegistrar registrar; | 202 content::NotificationRegistrar registrar; |
202 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 203 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, |
203 content::NotificationService::AllSources()); | 204 content::NotificationService::AllSources()); |
204 base::CancelableClosure timeout( | 205 base::CancelableClosure timeout( |
205 base::Bind(&TimeoutCallback, "Extension load timed out.")); | 206 base::Bind(&TimeoutCallback, "Extension load timed out.")); |
206 MessageLoop::current()->PostDelayedTask( | 207 MessageLoop::current()->PostDelayedTask( |
207 FROM_HERE, timeout.callback(), base::TimeDelta::FromSeconds(4)); | 208 FROM_HERE, timeout.callback(), base::TimeDelta::FromSeconds(4)); |
208 extensions::UnpackedInstaller::Create(service)->Load(path); | 209 extensions::UnpackedInstaller::Create(service)->Load(path); |
(...skipping 382 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
591 content::CONSOLE_MESSAGE_LEVEL_LOG, | 592 content::CONSOLE_MESSAGE_LEVEL_LOG, |
592 "log"); | 593 "log"); |
593 devtools_manager->AddMessageToConsole(agent_host, | 594 devtools_manager->AddMessageToConsole(agent_host, |
594 content::CONSOLE_MESSAGE_LEVEL_ERROR, | 595 content::CONSOLE_MESSAGE_LEVEL_ERROR, |
595 "error"); | 596 "error"); |
596 RunTestFunction(window_, "checkLogAndErrorMessages"); | 597 RunTestFunction(window_, "checkLogAndErrorMessages"); |
597 CloseDevToolsWindow(); | 598 CloseDevToolsWindow(); |
598 } | 599 } |
599 | 600 |
600 } // namespace | 601 } // namespace |
OLD | NEW |