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 <algorithm> | 5 #include <algorithm> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/bind.h" | 9 #include "base/bind.h" |
10 #include "base/bind_helpers.h" | 10 #include "base/bind_helpers.h" |
(...skipping 1674 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1685 #endif | 1685 #endif |
1686 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { | 1686 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { |
1687 CommandLine::ForCurrentProcess()->AppendSwitchASCII( | 1687 CommandLine::ForCurrentProcess()->AppendSwitchASCII( |
1688 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); | 1688 switches::kAppsGalleryInstallAutoConfirmForTests, "accept"); |
1689 | 1689 |
1690 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl( | 1690 const GURL install_source_url(URLRequestMockHTTPJob::GetMockUrl( |
1691 base::FilePath(FILE_PATH_LITERAL("extensions/*")))); | 1691 base::FilePath(FILE_PATH_LITERAL("extensions/*")))); |
1692 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl( | 1692 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl( |
1693 base::FilePath(FILE_PATH_LITERAL("policy/*")))); | 1693 base::FilePath(FILE_PATH_LITERAL("policy/*")))); |
1694 | 1694 |
| 1695 base::ScopedTempDir download_directory; |
| 1696 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); |
| 1697 DownloadPrefs* download_prefs = |
| 1698 DownloadPrefs::FromBrowserContext(browser()->profile()); |
| 1699 download_prefs->SetDownloadPath(download_directory.path()); |
| 1700 |
1695 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath( | 1701 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl(base::FilePath( |
1696 FILE_PATH_LITERAL("policy/extension_install_sources_test.html")))); | 1702 FILE_PATH_LITERAL("policy/extension_install_sources_test.html")))); |
1697 ui_test_utils::NavigateToURL(browser(), download_page_url); | 1703 ui_test_utils::NavigateToURL(browser(), download_page_url); |
1698 | 1704 |
1699 // As long as the policy is not present, extensions are considered dangerous. | 1705 // As long as the policy is not present, extensions are considered dangerous. |
1700 content::DownloadTestObserverTerminal download_observer( | 1706 content::DownloadTestObserverTerminal download_observer( |
1701 content::BrowserContext::GetDownloadManager(browser()->profile()), 1, | 1707 content::BrowserContext::GetDownloadManager(browser()->profile()), 1, |
1702 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY); | 1708 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY); |
1703 PerformClick(0, 0); | 1709 PerformClick(0, 0); |
1704 download_observer.WaitForFinished(); | 1710 download_observer.WaitForFinished(); |
(...skipping 1256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2961 PrefService* prefs = browser()->profile()->GetPrefs(); | 2967 PrefService* prefs = browser()->profile()->GetPrefs(); |
2962 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2968 EXPECT_TRUE(extensions::NativeMessageProcessHost::IsHostAllowed( |
2963 prefs, "host.name")); | 2969 prefs, "host.name")); |
2964 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( | 2970 EXPECT_FALSE(extensions::NativeMessageProcessHost::IsHostAllowed( |
2965 prefs, "other.host.name")); | 2971 prefs, "other.host.name")); |
2966 } | 2972 } |
2967 | 2973 |
2968 #endif // !defined(CHROME_OS) | 2974 #endif // !defined(CHROME_OS) |
2969 | 2975 |
2970 } // namespace policy | 2976 } // namespace policy |
OLD | NEW |