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 269 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 // must be empty. | 280 // must be empty. |
281 void DownloadAndVerifyFile( | 281 void DownloadAndVerifyFile( |
282 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { | 282 Browser* browser, const base::FilePath& dir, const base::FilePath& file) { |
283 content::DownloadManager* download_manager = | 283 content::DownloadManager* download_manager = |
284 content::BrowserContext::GetDownloadManager(browser->profile()); | 284 content::BrowserContext::GetDownloadManager(browser->profile()); |
285 content::DownloadTestObserverTerminal observer( | 285 content::DownloadTestObserverTerminal observer( |
286 download_manager, 1, | 286 download_manager, 1, |
287 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); | 287 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_FAIL); |
288 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); | 288 GURL url(URLRequestMockHTTPJob::GetMockUrl(file)); |
289 base::FilePath downloaded = dir.Append(file); | 289 base::FilePath downloaded = dir.Append(file); |
290 EXPECT_FALSE(file_util::PathExists(downloaded)); | 290 EXPECT_FALSE(base::PathExists(downloaded)); |
291 ui_test_utils::NavigateToURLWithDisposition( | 291 ui_test_utils::NavigateToURLWithDisposition( |
292 browser, url, CURRENT_TAB, | 292 browser, url, CURRENT_TAB, |
293 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); | 293 ui_test_utils::BROWSER_TEST_WAIT_FOR_NAVIGATION); |
294 observer.WaitForFinished(); | 294 observer.WaitForFinished(); |
295 EXPECT_EQ( | 295 EXPECT_EQ( |
296 1u, observer.NumDownloadsSeenInState(content::DownloadItem::COMPLETE)); | 296 1u, observer.NumDownloadsSeenInState(content::DownloadItem::COMPLETE)); |
297 EXPECT_TRUE(file_util::PathExists(downloaded)); | 297 EXPECT_TRUE(base::PathExists(downloaded)); |
298 base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES); | 298 base::FileEnumerator enumerator(dir, false, base::FileEnumerator::FILES); |
299 EXPECT_EQ(file, enumerator.Next().BaseName()); | 299 EXPECT_EQ(file, enumerator.Next().BaseName()); |
300 EXPECT_EQ(base::FilePath(), enumerator.Next()); | 300 EXPECT_EQ(base::FilePath(), enumerator.Next()); |
301 } | 301 } |
302 | 302 |
303 #if defined(OS_CHROMEOS) | 303 #if defined(OS_CHROMEOS) |
304 int CountScreenshots() { | 304 int CountScreenshots() { |
305 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( | 305 DownloadPrefs* download_prefs = DownloadPrefs::FromBrowserContext( |
306 ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); | 306 ash::Shell::GetInstance()->delegate()->GetCurrentBrowserContext()); |
307 base::FileEnumerator enumerator(download_prefs->DownloadPath(), | 307 base::FileEnumerator enumerator(download_prefs->DownloadPath(), |
(...skipping 812 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1120 UpdateProviderPolicy(policies); | 1120 UpdateProviderPolicy(policies); |
1121 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash)); | 1121 EXPECT_TRUE(plugin_prefs->IsPluginEnabled(*flash)); |
1122 } | 1122 } |
1123 | 1123 |
1124 IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { | 1124 IN_PROC_BROWSER_TEST_F(PolicyTest, AlwaysAuthorizePlugins) { |
1125 // Verifies that dangerous plugins can be always authorized to run with | 1125 // Verifies that dangerous plugins can be always authorized to run with |
1126 // a policy. | 1126 // a policy. |
1127 | 1127 |
1128 // Verify that the test page exists. It is only present in checkouts with | 1128 // Verify that the test page exists. It is only present in checkouts with |
1129 // src-internal. | 1129 // src-internal. |
1130 if (!file_util::PathExists(ui_test_utils::GetTestFilePath( | 1130 if (!base::PathExists(ui_test_utils::GetTestFilePath( |
1131 base::FilePath(FILE_PATH_LITERAL("plugin")), | 1131 base::FilePath(FILE_PATH_LITERAL("plugin")), |
1132 base::FilePath(FILE_PATH_LITERAL("quicktime.html"))))) { | 1132 base::FilePath(FILE_PATH_LITERAL("quicktime.html"))))) { |
1133 LOG(INFO) << | 1133 LOG(INFO) << |
1134 "Test skipped because plugin/quicktime.html test file wasn't found."; | 1134 "Test skipped because plugin/quicktime.html test file wasn't found."; |
1135 return; | 1135 return; |
1136 } | 1136 } |
1137 | 1137 |
1138 ServeContentTestData(); | 1138 ServeContentTestData(); |
1139 // No plugins at startup. | 1139 // No plugins at startup. |
1140 EXPECT_EQ(0, CountPlugins()); | 1140 EXPECT_EQ(0, CountPlugins()); |
(...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1242 // Override the download directory with the policy and verify a download. | 1242 // Override the download directory with the policy and verify a download. |
1243 base::ScopedTempDir forced_dir; | 1243 base::ScopedTempDir forced_dir; |
1244 ASSERT_TRUE(forced_dir.CreateUniqueTempDir()); | 1244 ASSERT_TRUE(forced_dir.CreateUniqueTempDir()); |
1245 PolicyMap policies; | 1245 PolicyMap policies; |
1246 policies.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, | 1246 policies.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, |
1247 POLICY_SCOPE_USER, | 1247 POLICY_SCOPE_USER, |
1248 base::Value::CreateStringValue(forced_dir.path().value()), NULL); | 1248 base::Value::CreateStringValue(forced_dir.path().value()), NULL); |
1249 UpdateProviderPolicy(policies); | 1249 UpdateProviderPolicy(policies); |
1250 DownloadAndVerifyFile(browser(), forced_dir.path(), file); | 1250 DownloadAndVerifyFile(browser(), forced_dir.path(), file); |
1251 // Verify that the first download location wasn't affected. | 1251 // Verify that the first download location wasn't affected. |
1252 EXPECT_FALSE(file_util::PathExists(initial_dir.path().Append(file))); | 1252 EXPECT_FALSE(base::PathExists(initial_dir.path().Append(file))); |
1253 } | 1253 } |
1254 #endif | 1254 #endif |
1255 | 1255 |
1256 // See crbug.com/248464 | 1256 // See crbug.com/248464 |
1257 #if defined(OS_WIN) | 1257 #if defined(OS_WIN) |
1258 #define MAYBE_ExtensionInstallBlacklist DISABLED_ExtensionInstallBlacklist | 1258 #define MAYBE_ExtensionInstallBlacklist DISABLED_ExtensionInstallBlacklist |
1259 #else | 1259 #else |
1260 #define MAYBE_ExtensionInstallBlacklist ExtensionInstallBlacklist | 1260 #define MAYBE_ExtensionInstallBlacklist ExtensionInstallBlacklist |
1261 #endif | 1261 #endif |
1262 | 1262 |
(...skipping 1219 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2482 chrome_variations::VariationsService::GetVariationsServerURL( | 2482 chrome_variations::VariationsService::GetVariationsServerURL( |
2483 g_browser_process->local_state()); | 2483 g_browser_process->local_state()); |
2484 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); | 2484 EXPECT_TRUE(StartsWithASCII(url.spec(), default_variations_url, true)); |
2485 std::string value; | 2485 std::string value; |
2486 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); | 2486 EXPECT_TRUE(net::GetValueForKeyInQuery(url, "restrict", &value)); |
2487 EXPECT_EQ("restricted", value); | 2487 EXPECT_EQ("restricted", value); |
2488 } | 2488 } |
2489 #endif | 2489 #endif |
2490 | 2490 |
2491 } // namespace policy | 2491 } // namespace policy |
OLD | NEW |