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 <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 16 matching lines...) Expand all Loading... |
27 #include "base/path_service.h" | 27 #include "base/path_service.h" |
28 #include "base/run_loop.h" | 28 #include "base/run_loop.h" |
29 #include "base/strings/string16.h" | 29 #include "base/strings/string16.h" |
30 #include "base/strings/string_number_conversions.h" | 30 #include "base/strings/string_number_conversions.h" |
31 #include "base/strings/string_util.h" | 31 #include "base/strings/string_util.h" |
32 #include "base/strings/stringprintf.h" | 32 #include "base/strings/stringprintf.h" |
33 #include "base/strings/utf_string_conversions.h" | 33 #include "base/strings/utf_string_conversions.h" |
34 #include "base/test/scoped_feature_list.h" | 34 #include "base/test/scoped_feature_list.h" |
35 #include "base/test/test_file_util.h" | 35 #include "base/test/test_file_util.h" |
36 #include "base/threading/sequenced_worker_pool.h" | 36 #include "base/threading/sequenced_worker_pool.h" |
| 37 #include "base/threading/thread_restrictions.h" |
37 #include "base/time/time.h" | 38 #include "base/time/time.h" |
38 #include "base/values.h" | 39 #include "base/values.h" |
39 #include "build/build_config.h" | 40 #include "build/build_config.h" |
40 #include "chrome/app/chrome_command_ids.h" | 41 #include "chrome/app/chrome_command_ids.h" |
41 #include "chrome/browser/background/background_contents_service.h" | 42 #include "chrome/browser/background/background_contents_service.h" |
42 #include "chrome/browser/browser_process.h" | 43 #include "chrome/browser/browser_process.h" |
43 #include "chrome/browser/chrome_notification_types.h" | 44 #include "chrome/browser/chrome_notification_types.h" |
44 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" | 45 #include "chrome/browser/component_updater/chrome_component_updater_configurator
.h" |
45 #include "chrome/browser/content_settings/tab_specific_content_settings.h" | 46 #include "chrome/browser/content_settings/tab_specific_content_settings.h" |
46 #include "chrome/browser/devtools/devtools_window_testing.h" | 47 #include "chrome/browser/devtools/devtools_window_testing.h" |
(...skipping 821 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
868 IN_PROC_BROWSER_TEST_F(LocalePolicyTest, ApplicationLocaleValue) { | 869 IN_PROC_BROWSER_TEST_F(LocalePolicyTest, ApplicationLocaleValue) { |
869 // Verifies that the default locale can be overridden with policy. | 870 // Verifies that the default locale can be overridden with policy. |
870 EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); | 871 EXPECT_EQ("fr", g_browser_process->GetApplicationLocale()); |
871 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 872 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
872 base::string16 french_title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); | 873 base::string16 french_title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); |
873 base::string16 title; | 874 base::string16 title; |
874 EXPECT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title)); | 875 EXPECT_TRUE(ui_test_utils::GetCurrentTabTitle(browser(), &title)); |
875 EXPECT_EQ(french_title, title); | 876 EXPECT_EQ(french_title, title); |
876 | 877 |
877 // Make sure this is really French and differs from the English title. | 878 // Make sure this is really French and differs from the English title. |
| 879 base::ThreadRestrictions::ScopedAllowIO allow_io; |
878 std::string loaded = | 880 std::string loaded = |
879 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("en-US"); | 881 ui::ResourceBundle::GetSharedInstance().ReloadLocaleResources("en-US"); |
880 EXPECT_EQ("en-US", loaded); | 882 EXPECT_EQ("en-US", loaded); |
881 base::string16 english_title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); | 883 base::string16 english_title = l10n_util::GetStringUTF16(IDS_NEW_TAB_TITLE); |
882 EXPECT_NE(french_title, english_title); | 884 EXPECT_NE(french_title, english_title); |
883 } | 885 } |
884 #endif | 886 #endif |
885 | 887 |
886 IN_PROC_BROWSER_TEST_F(PolicyTest, BookmarkBarEnabled) { | 888 IN_PROC_BROWSER_TEST_F(PolicyTest, BookmarkBarEnabled) { |
887 // Verifies that the bookmarks bar can be forced to always or never show up. | 889 // Verifies that the bookmarks bar can be forced to always or never show up. |
(...skipping 539 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1427 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); | 1429 ui_test_utils::NavigateToURL(browser(), GURL(chrome::kChromeUINewTabURL)); |
1428 EXPECT_FALSE(ContainsVisibleElement(contents, | 1430 EXPECT_FALSE(ContainsVisibleElement(contents, |
1429 "ahfgeienlihckogmohjhadlkjgocpleb")); | 1431 "ahfgeienlihckogmohjhadlkjgocpleb")); |
1430 EXPECT_FALSE(ContainsVisibleElement(contents, "chrome-web-store-link")); | 1432 EXPECT_FALSE(ContainsVisibleElement(contents, "chrome-web-store-link")); |
1431 } | 1433 } |
1432 | 1434 |
1433 IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { | 1435 IN_PROC_BROWSER_TEST_F(PolicyTest, DownloadDirectory) { |
1434 // Verifies that the download directory can be forced by policy. | 1436 // Verifies that the download directory can be forced by policy. |
1435 | 1437 |
1436 // Set the initial download directory. | 1438 // Set the initial download directory. |
| 1439 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1437 base::ScopedTempDir initial_dir; | 1440 base::ScopedTempDir initial_dir; |
1438 ASSERT_TRUE(initial_dir.CreateUniqueTempDir()); | 1441 ASSERT_TRUE(initial_dir.CreateUniqueTempDir()); |
1439 browser()->profile()->GetPrefs()->SetFilePath( | 1442 browser()->profile()->GetPrefs()->SetFilePath( |
1440 prefs::kDownloadDefaultDirectory, initial_dir.GetPath()); | 1443 prefs::kDownloadDefaultDirectory, initial_dir.GetPath()); |
1441 // Don't prompt for the download location during this test. | 1444 // Don't prompt for the download location during this test. |
1442 browser()->profile()->GetPrefs()->SetBoolean( | 1445 browser()->profile()->GetPrefs()->SetBoolean( |
1443 prefs::kPromptForDownload, false); | 1446 prefs::kPromptForDownload, false); |
1444 | 1447 |
1445 // Verify that downloads end up on the default directory. | 1448 // Verify that downloads end up on the default directory. |
1446 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); | 1449 base::FilePath file(FILE_PATH_LITERAL("download-test1.lib")); |
(...skipping 378 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1825 #define MAYBE_ExtensionInstallSources ExtensionInstallSources | 1828 #define MAYBE_ExtensionInstallSources ExtensionInstallSources |
1826 #endif | 1829 #endif |
1827 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { | 1830 IN_PROC_BROWSER_TEST_F(PolicyTest, MAYBE_ExtensionInstallSources) { |
1828 extensions::ScopedTestDialogAutoConfirm auto_confirm( | 1831 extensions::ScopedTestDialogAutoConfirm auto_confirm( |
1829 extensions::ScopedTestDialogAutoConfirm::ACCEPT); | 1832 extensions::ScopedTestDialogAutoConfirm::ACCEPT); |
1830 | 1833 |
1831 const GURL install_source_url( | 1834 const GURL install_source_url( |
1832 URLRequestMockHTTPJob::GetMockUrl("extensions/*")); | 1835 URLRequestMockHTTPJob::GetMockUrl("extensions/*")); |
1833 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl("policy/*")); | 1836 const GURL referrer_url(URLRequestMockHTTPJob::GetMockUrl("policy/*")); |
1834 | 1837 |
| 1838 base::ThreadRestrictions::ScopedAllowIO allow_io; |
1835 base::ScopedTempDir download_directory; | 1839 base::ScopedTempDir download_directory; |
1836 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); | 1840 ASSERT_TRUE(download_directory.CreateUniqueTempDir()); |
1837 DownloadPrefs* download_prefs = | 1841 DownloadPrefs* download_prefs = |
1838 DownloadPrefs::FromBrowserContext(browser()->profile()); | 1842 DownloadPrefs::FromBrowserContext(browser()->profile()); |
1839 download_prefs->SetDownloadPath(download_directory.GetPath()); | 1843 download_prefs->SetDownloadPath(download_directory.GetPath()); |
1840 | 1844 |
1841 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl( | 1845 const GURL download_page_url(URLRequestMockHTTPJob::GetMockUrl( |
1842 "policy/extension_install_sources_test.html")); | 1846 "policy/extension_install_sources_test.html")); |
1843 ui_test_utils::NavigateToURL(browser(), download_page_url); | 1847 ui_test_utils::NavigateToURL(browser(), download_page_url); |
1844 | 1848 |
(...skipping 2638 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
4483 | 4487 |
4484 SetEmptyPolicy(); | 4488 SetEmptyPolicy(); |
4485 // Policy not set. | 4489 // Policy not set. |
4486 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4490 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
4487 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4491 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
4488 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4492 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
4489 } | 4493 } |
4490 #endif // defined(OS_CHROMEOS) | 4494 #endif // defined(OS_CHROMEOS) |
4491 | 4495 |
4492 } // namespace policy | 4496 } // namespace policy |
OLD | NEW |