Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(201)

Side by Side Diff: chrome/browser/policy/policy_browsertest.cc

Issue 2317123002: c/browser, c/common, components O-P: Change ScopedTempDir::path() to GetPath() (Closed)
Patch Set: Just rebased Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 <stddef.h> 5 #include <stddef.h>
6 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include <algorithm> 8 #include <algorithm>
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 1489 matching lines...) Expand 10 before | Expand all | Expand 10 after
1500 EXPECT_FALSE(ContainsVisibleElement(contents, "chrome-web-store-link")); 1500 EXPECT_FALSE(ContainsVisibleElement(contents, "chrome-web-store-link"));
1501 } 1501 }
1502 1502
1503 IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { 1503 IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) {
1504 // Verifies that the download directory can be forced by policy. 1504 // Verifies that the download directory can be forced by policy.
1505 1505
1506 // Set the initial download directory. 1506 // Set the initial download directory.
1507 base::ScopedTempDir initial_dir; 1507 base::ScopedTempDir initial_dir;
1508 ASSERT_TRUE(initial_dir.CreateUniqueTempDir()); 1508 ASSERT_TRUE(initial_dir.CreateUniqueTempDir());
1509 browser()->profile()->GetPrefs()->SetFilePath( 1509 browser()->profile()->GetPrefs()->SetFilePath(
1510 prefs::kDownloadDefaultDirectory, initial_dir.path()); 1510 prefs::kDownloadDefaultDirectory, initial_dir.GetPath());
1511 // Don't prompt for the download location during this test. 1511 // Don't prompt for the download location during this test.
1512 browser()->profile()->GetPrefs()->SetBoolean( 1512 browser()->profile()->GetPrefs()->SetBoolean(
1513 prefs::kPromptForDownload, false); 1513 prefs::kPromptForDownload, false);
1514 1514
1515 // Verify that downloads end up on the default directory. 1515 // Verify that downloads end up on the default directory.
1516 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 1516 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
1517 DownloadAndVerifyFile(browser(), initial_dir.path(), file); 1517 DownloadAndVerifyFile(browser(), initial_dir.GetPath(), file);
1518 base::DieFileDie(initial_dir.path().Append(file), false); 1518 base::DieFileDie(initial_dir.GetPath().Append(file), false);
1519 1519
1520 // Override the download directory with the policy and verify a download. 1520 // Override the download directory with the policy and verify a download.
1521 base::ScopedTempDir forced_dir; 1521 base::ScopedTempDir forced_dir;
1522 ASSERT_TRUE(forced_dir.CreateUniqueTempDir()); 1522 ASSERT_TRUE(forced_dir.CreateUniqueTempDir());
1523 PolicyMap policies; 1523 PolicyMap policies;
1524 policies.Set(key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, 1524 policies.Set(
1525 POLICY_SCOPE_USER, POLICY_SOURCE_CLOUD, 1525 key::kDownloadDirectory, POLICY_LEVEL_MANDATORY, POLICY_SCOPE_USER,
1526 base::MakeUnique<base::StringValue>(forced_dir.path().value()), 1526 POLICY_SOURCE_CLOUD,
1527 nullptr); 1527 base::MakeUnique<base::StringValue>(forced_dir.GetPath().value()),
1528 nullptr);
1528 UpdateProviderPolicy(policies); 1529 UpdateProviderPolicy(policies);
1529 DownloadAndVerifyFile(browser(), forced_dir.path(), file); 1530 DownloadAndVerifyFile(browser(), forced_dir.GetPath(), file);
1530 // Verify that the first download location wasn't affected. 1531 // Verify that the first download location wasn't affected.
1531 EXPECT_FALSE(base::PathExists(initial_dir.path().Append(file))); 1532 EXPECT_FALSE(base::PathExists(initial_dir.GetPath().Append(file)));
1532 } 1533 }
1533 1534
1534 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) { 1535 IN_PROC_BROWSER_TEST_F(PolicyTest, ExtensionInstallBlacklistSelective) {
1535 // Verifies that blacklisted extensions can't be installed. 1536 // Verifies that blacklisted extensions can't be installed.
1536 ExtensionService* service = extension_service(); 1537 ExtensionService* service = extension_service();
1537 ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true)); 1538 ASSERT_FALSE(service->GetExtensionById(kGoodCrxId, true));
1538 ASSERT_FALSE(service->GetExtensionById(kAdBlockCrxId, true)); 1539 ASSERT_FALSE(service->GetExtensionById(kAdBlockCrxId, true));
1539 base::ListValue blacklist; 1540 base::ListValue blacklist;
1540 blacklist.AppendString(kGoodCrxId); 1541 blacklist.AppendString(kGoodCrxId);
1541 PolicyMap policies; 1542 PolicyMap policies;
(...skipping 347 matching lines...) Expand 10 before | Expand all | Expand 10 after
1889 extensions::ScopedTestDialogAutoConfirm::ACCEPT); 1890 extensions::ScopedTestDialogAutoConfirm::ACCEPT);
1890 1891
1891 const GURL install_source_url( 1892 const GURL install_source_url(
1892 URLRequestMockHTTPJob::GetMockUrl("extensions/*")); 1893 URLRequestMockHTTPJob::GetMockUrl("extensions/*"));
1893 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl("policy/*")); 1894 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl("policy/*"));
1894 1895
1895 base::ScopedTempDir download_directory; 1896 base::ScopedTempDir download_directory;
1896 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); 1897 ASSERT_TRUE(download_directory.CreateUniqueTempDir());
1897 DownloadPrefs* download_prefs = 1898 DownloadPrefs* download_prefs =
1898 DownloadPrefs::FromBrowserContext(browser()->profile()); 1899 DownloadPrefs::FromBrowserContext(browser()->profile());
1899 download_prefs->SetDownloadPath(download_directory.path()); 1900 download_prefs->SetDownloadPath(download_directory.GetPath());
1900 1901
1901 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl( 1902 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl(
1902 "policy/extension_install_sources_test.html")); 1903 "policy/extension_install_sources_test.html"));
1903 ui_test_utils::NavigateToURL(browser(), download_page_url); 1904 ui_test_utils::NavigateToURL(browser(), download_page_url);
1904 1905
1905 // As long as the policy is not present, extensions are considered dangerous. 1906 // As long as the policy is not present, extensions are considered dangerous.
1906 content::DownloadTestObserverTerminal download_observer( 1907 content::DownloadTestObserverTerminal download_observer(
1907 content::BrowserContext::GetDownloadManager(browser()->profile()), 1, 1908 content::BrowserContext::GetDownloadManager(browser()->profile()), 1,
1908 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY); 1909 content::DownloadTestObserver::ON_DANGEROUS_DOWNLOAD_DENY);
1909 PerformClick(0, 0); 1910 PerformClick(0, 0);
(...skipping 2458 matching lines...) Expand 10 before | Expand all | Expand 10 after
4368 4369
4369 SetEmptyPolicy(); 4370 SetEmptyPolicy();
4370 // Policy not set. 4371 // Policy not set.
4371 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); 4372 CheckSystemTimezoneAutomaticDetectionPolicyUnset();
4372 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); 4373 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false));
4373 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); 4374 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests());
4374 } 4375 }
4375 #endif // defined(OS_CHROMEOS) 4376 #endif // defined(OS_CHROMEOS)
4376 4377
4377 } // namespace policy 4378 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/cloud/cloud_policy_browsertest.cc ('k') | chrome/browser/policy/test/local_policy_test_server.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698