| 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 "chrome/browser/download/download_crx_util.h" | 5 #include "chrome/browser/download/download_crx_util.h" |
| 6 #include "chrome/browser/download/download_service.h" | 6 #include "chrome/browser/download/download_service.h" |
| 7 #include "chrome/browser/download/download_service_factory.h" | 7 #include "chrome/browser/download/download_service_factory.h" |
| 8 #include "chrome/browser/download/download_test_observer.h" | 8 #include "chrome/browser/download/download_test_observer.h" |
| 9 #include "chrome/browser/extensions/crx_installer.h" | 9 #include "chrome/browser/extensions/crx_installer.h" |
| 10 #include "chrome/browser/extensions/extension_browsertest.h" | 10 #include "chrome/browser/extensions/extension_browsertest.h" |
| (...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 149 test_data_dir_.AppendASCII("common/background_page")); | 149 test_data_dir_.AppendASCII("common/background_page")); |
| 150 ASSERT_FALSE(crx_path.empty()); | 150 ASSERT_FALSE(crx_path.empty()); |
| 151 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); | 151 std::string crx_path_string(crx_path.value().begin(), crx_path.value().end()); |
| 152 GURL url = GURL(std::string("file:///").append(crx_path_string)); | 152 GURL url = GURL(std::string("file:///").append(crx_path_string)); |
| 153 | 153 |
| 154 MockInstallUI* mock_ui = new MockInstallUI(browser()->profile()); | 154 MockInstallUI* mock_ui = new MockInstallUI(browser()->profile()); |
| 155 download_crx_util::SetMockInstallUIForTesting(mock_ui); | 155 download_crx_util::SetMockInstallUIForTesting(mock_ui); |
| 156 | 156 |
| 157 LOG(ERROR) << "PackAndInstallExtension: Getting download manager"; | 157 LOG(ERROR) << "PackAndInstallExtension: Getting download manager"; |
| 158 content::DownloadManager* download_manager = | 158 content::DownloadManager* download_manager = |
| 159 DownloadServiceFactory::GetForProfile( | 159 content::BrowserContext::GetDownloadManager(browser()->profile()); |
| 160 browser()->profile())->GetDownloadManager(); | |
| 161 | 160 |
| 162 LOG(ERROR) << "PackAndInstallExtension: Setting observer"; | 161 LOG(ERROR) << "PackAndInstallExtension: Setting observer"; |
| 163 scoped_ptr<DownloadTestObserver> observer( | 162 scoped_ptr<DownloadTestObserver> observer( |
| 164 new DownloadTestObserverTerminal( | 163 new DownloadTestObserverTerminal( |
| 165 download_manager, kNumDownloadsExpected, kExpectFileSelectDialog, | 164 download_manager, kNumDownloadsExpected, kExpectFileSelectDialog, |
| 166 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); | 165 DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_ACCEPT)); |
| 167 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL"; | 166 LOG(ERROR) << "PackAndInstallExtension: Navigating to URL"; |
| 168 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, | 167 ui_test_utils::NavigateToURLWithDisposition(browser(), url, CURRENT_TAB, |
| 169 ui_test_utils::BROWSER_TEST_NONE); | 168 ui_test_utils::BROWSER_TEST_NONE); |
| 170 | 169 |
| (...skipping 25 matching lines...) Expand all Loading... |
| 196 if (kTestData[i]) { | 195 if (kTestData[i]) { |
| 197 EXPECT_EQ(string16(), mock_ui->error()) << kTestData[i]; | 196 EXPECT_EQ(string16(), mock_ui->error()) << kTestData[i]; |
| 198 } else { | 197 } else { |
| 199 EXPECT_EQ(l10n_util::GetStringUTF16( | 198 EXPECT_EQ(l10n_util::GetStringUTF16( |
| 200 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), | 199 IDS_EXTENSION_INSTALL_DISALLOWED_ON_SITE), |
| 201 mock_ui->error()) << kTestData[i]; | 200 mock_ui->error()) << kTestData[i]; |
| 202 } | 201 } |
| 203 } | 202 } |
| 204 #endif | 203 #endif |
| 205 } | 204 } |
| OLD | NEW |