| OLD | NEW |
| 1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/apps/drive/drive_app_provider.h" | 5 #include "chrome/browser/apps/drive/drive_app_provider.h" |
| 6 | 6 |
| 7 #include "base/logging.h" | 7 #include "base/logging.h" |
| 8 #include "base/macros.h" | 8 #include "base/macros.h" |
| 9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 97 InstallExtension(test_data_path, expected_change); | 97 InstallExtension(test_data_path, expected_change); |
| 98 return extension; | 98 return extension; |
| 99 } | 99 } |
| 100 | 100 |
| 101 void RefreshDriveAppRegistry() { | 101 void RefreshDriveAppRegistry() { |
| 102 apps_registry_->Update(); | 102 apps_registry_->Update(); |
| 103 content::RunAllPendingInMessageLoop(); | 103 content::RunAllPendingInMessageLoop(); |
| 104 } | 104 } |
| 105 | 105 |
| 106 void WaitForPendingDriveAppConverters() { | 106 void WaitForPendingDriveAppConverters() { |
| 107 DCHECK(!runner_); | 107 DCHECK(!runner_.get()); |
| 108 | 108 |
| 109 if (provider_->pending_converters_.empty()) | 109 if (provider_->pending_converters_.empty()) |
| 110 return; | 110 return; |
| 111 | 111 |
| 112 runner_ = new content::MessageLoopRunner; | 112 runner_ = new content::MessageLoopRunner; |
| 113 | 113 |
| 114 pending_drive_app_converter_check_timer_.Start( | 114 pending_drive_app_converter_check_timer_.Start( |
| 115 FROM_HERE, | 115 FROM_HERE, |
| 116 base::TimeDelta::FromMilliseconds(50), | 116 base::TimeDelta::FromMilliseconds(50), |
| 117 base::Bind(&DriveAppProviderTest::OnPendingDriveAppConverterCheckTimer, | 117 base::Bind(&DriveAppProviderTest::OnPendingDriveAppConverterCheckTimer, |
| 118 base::Unretained(this))); | 118 base::Unretained(this))); |
| 119 | 119 |
| 120 runner_->Run(); | 120 runner_->Run(); |
| 121 | 121 |
| 122 pending_drive_app_converter_check_timer_.Stop(); | 122 pending_drive_app_converter_check_timer_.Stop(); |
| 123 runner_ = NULL; | 123 runner_ = NULL; |
| 124 } | 124 } |
| 125 | 125 |
| 126 void InstallUserUrlApp(const std::string& url) { | 126 void InstallUserUrlApp(const std::string& url) { |
| 127 DCHECK(!runner_); | 127 DCHECK(!runner_.get()); |
| 128 runner_ = new content::MessageLoopRunner; | 128 runner_ = new content::MessageLoopRunner; |
| 129 | 129 |
| 130 WebApplicationInfo web_app; | 130 WebApplicationInfo web_app; |
| 131 web_app.title = base::ASCIIToUTF16("User installed Url app"); | 131 web_app.title = base::ASCIIToUTF16("User installed Url app"); |
| 132 web_app.app_url = GURL(url); | 132 web_app.app_url = GURL(url); |
| 133 | 133 |
| 134 scoped_refptr<extensions::CrxInstaller> crx_installer = | 134 scoped_refptr<extensions::CrxInstaller> crx_installer = |
| 135 extensions::CrxInstaller::CreateSilent( | 135 extensions::CrxInstaller::CreateSilent( |
| 136 extensions::ExtensionSystem::Get(profile())->extension_service()); | 136 extensions::ExtensionSystem::Get(profile())->extension_service()); |
| 137 crx_installer->set_creation_flags(Extension::FROM_BOOKMARK); | 137 crx_installer->set_creation_flags(Extension::FROM_BOOKMARK); |
| (...skipping 306 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 444 InstallUserUrlApp(kLaunchUrl); | 444 InstallUserUrlApp(kLaunchUrl); |
| 445 EXPECT_FALSE(mapping()->IsChromeAppGenerated(url_app_id)); | 445 EXPECT_FALSE(mapping()->IsChromeAppGenerated(url_app_id)); |
| 446 | 446 |
| 447 fake_drive_service()->RemoveAppByProductId(kChromeAppId); | 447 fake_drive_service()->RemoveAppByProductId(kChromeAppId); |
| 448 RefreshDriveAppRegistry(); | 448 RefreshDriveAppRegistry(); |
| 449 | 449 |
| 450 // Url app is still present after the Drive app is disconnected. | 450 // Url app is still present after the Drive app is disconnected. |
| 451 EXPECT_TRUE(ExtensionRegistry::Get(profile())->GetExtensionById( | 451 EXPECT_TRUE(ExtensionRegistry::Get(profile())->GetExtensionById( |
| 452 url_app_id, ExtensionRegistry::EVERYTHING)); | 452 url_app_id, ExtensionRegistry::EVERYTHING)); |
| 453 } | 453 } |
| OLD | NEW |