| 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 330 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 341 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; | 341 ASSERT_TRUE(LoadExtensionFromPath(path)) << "Failed to load extension."; |
| 342 } | 342 } |
| 343 | 343 |
| 344 private: | 344 private: |
| 345 bool LoadExtensionFromPath(const base::FilePath& path) { | 345 bool LoadExtensionFromPath(const base::FilePath& path) { |
| 346 ExtensionService* service = extensions::ExtensionSystem::Get( | 346 ExtensionService* service = extensions::ExtensionSystem::Get( |
| 347 browser()->profile())->extension_service(); | 347 browser()->profile())->extension_service(); |
| 348 size_t num_before = service->extensions()->size(); | 348 size_t num_before = service->extensions()->size(); |
| 349 { | 349 { |
| 350 content::NotificationRegistrar registrar; | 350 content::NotificationRegistrar registrar; |
| 351 registrar.Add(this, chrome::NOTIFICATION_EXTENSION_LOADED, | 351 registrar.Add(this, |
| 352 chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED, |
| 352 content::NotificationService::AllSources()); | 353 content::NotificationService::AllSources()); |
| 353 base::CancelableClosure timeout( | 354 base::CancelableClosure timeout( |
| 354 base::Bind(&TimeoutCallback, "Extension load timed out.")); | 355 base::Bind(&TimeoutCallback, "Extension load timed out.")); |
| 355 base::MessageLoop::current()->PostDelayedTask( | 356 base::MessageLoop::current()->PostDelayedTask( |
| 356 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); | 357 FROM_HERE, timeout.callback(), TestTimeouts::action_timeout()); |
| 357 extensions::UnpackedInstaller::Create(service)->Load(path); | 358 extensions::UnpackedInstaller::Create(service)->Load(path); |
| 358 content::RunMessageLoop(); | 359 content::RunMessageLoop(); |
| 359 timeout.Cancel(); | 360 timeout.Cancel(); |
| 360 } | 361 } |
| 361 size_t num_after = service->extensions()->size(); | 362 size_t num_after = service->extensions()->size(); |
| (...skipping 30 matching lines...) Expand all Loading... |
| 392 } | 393 } |
| 393 | 394 |
| 394 timeout.Cancel(); | 395 timeout.Cancel(); |
| 395 return true; | 396 return true; |
| 396 } | 397 } |
| 397 | 398 |
| 398 virtual void Observe(int type, | 399 virtual void Observe(int type, |
| 399 const content::NotificationSource& source, | 400 const content::NotificationSource& source, |
| 400 const content::NotificationDetails& details) OVERRIDE { | 401 const content::NotificationDetails& details) OVERRIDE { |
| 401 switch (type) { | 402 switch (type) { |
| 402 case chrome::NOTIFICATION_EXTENSION_LOADED: | 403 case chrome::NOTIFICATION_EXTENSION_LOADED_DEPRECATED: |
| 403 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: | 404 case chrome::NOTIFICATION_EXTENSION_HOST_DID_STOP_LOADING: |
| 404 base::MessageLoopForUI::current()->Quit(); | 405 base::MessageLoopForUI::current()->Quit(); |
| 405 break; | 406 break; |
| 406 default: | 407 default: |
| 407 NOTREACHED(); | 408 NOTREACHED(); |
| 408 break; | 409 break; |
| 409 } | 410 } |
| 410 } | 411 } |
| 411 | 412 |
| 412 base::FilePath test_extensions_dir_; | 413 base::FilePath test_extensions_dir_; |
| (...skipping 540 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 953 | 954 |
| 954 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { | 955 IN_PROC_BROWSER_TEST_F(RemoteDebuggingTest, RemoteDebugger) { |
| 955 #if defined(OS_WIN) && defined(USE_ASH) | 956 #if defined(OS_WIN) && defined(USE_ASH) |
| 956 // Disable this test in Metro+Ash for now (http://crbug.com/262796). | 957 // Disable this test in Metro+Ash for now (http://crbug.com/262796). |
| 957 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) | 958 if (CommandLine::ForCurrentProcess()->HasSwitch(switches::kAshBrowserTests)) |
| 958 return; | 959 return; |
| 959 #endif | 960 #endif |
| 960 | 961 |
| 961 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; | 962 ASSERT_TRUE(RunExtensionTest("target_list")) << message_; |
| 962 } | 963 } |
| OLD | NEW |