OLD | NEW |
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 <map> | 5 #include <map> |
6 #include <set> | 6 #include <set> |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "ash/shell.h" | 10 #include "ash/shell.h" |
(...skipping 997 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1008 ASSERT_TRUE(browser_window); | 1008 ASSERT_TRUE(browser_window); |
1009 | 1009 |
1010 // Verify that an attempt to enter fullscreen mode is denied. | 1010 // Verify that an attempt to enter fullscreen mode is denied. |
1011 EXPECT_FALSE(browser_window->IsFullscreen()); | 1011 EXPECT_FALSE(browser_window->IsFullscreen()); |
1012 chrome::ToggleFullscreenMode(browser); | 1012 chrome::ToggleFullscreenMode(browser); |
1013 EXPECT_FALSE(browser_window->IsFullscreen()); | 1013 EXPECT_FALSE(browser_window->IsFullscreen()); |
1014 } | 1014 } |
1015 | 1015 |
1016 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) { | 1016 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsUncached) { |
1017 // Make it possible to force-install a hosted app and an extension. | 1017 // Make it possible to force-install a hosted app and an extension. |
1018 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 1018 ASSERT_TRUE(embedded_test_server()->Start()); |
1019 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( | 1019 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( |
1020 new TestingUpdateManifestProvider(kRelativeUpdateURL)); | 1020 new TestingUpdateManifestProvider(kRelativeUpdateURL)); |
1021 testing_update_manifest_provider->AddUpdate( | 1021 testing_update_manifest_provider->AddUpdate( |
1022 kHostedAppID, kHostedAppVersion, | 1022 kHostedAppID, kHostedAppVersion, |
1023 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); | 1023 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); |
1024 testing_update_manifest_provider->AddUpdate( | 1024 testing_update_manifest_provider->AddUpdate( |
1025 kGoodExtensionID, kGoodExtensionVersion, | 1025 kGoodExtensionID, kGoodExtensionVersion, |
1026 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); | 1026 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); |
1027 embedded_test_server()->RegisterRequestHandler( | 1027 embedded_test_server()->RegisterRequestHandler( |
1028 base::Bind(&TestingUpdateManifestProvider::HandleRequest, | 1028 base::Bind(&TestingUpdateManifestProvider::HandleRequest, |
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1086 ->GetDeviceLocalAccountPolicyService() | 1086 ->GetDeviceLocalAccountPolicyService() |
1087 ->GetBrokerForUser(account_id_1_.GetUserEmail()); | 1087 ->GetBrokerForUser(account_id_1_.GetUserEmail()); |
1088 ASSERT_TRUE(broker); | 1088 ASSERT_TRUE(broker); |
1089 chromeos::ExternalCache* cache = | 1089 chromeos::ExternalCache* cache = |
1090 broker->extension_loader()->GetExternalCacheForTesting(); | 1090 broker->extension_loader()->GetExternalCacheForTesting(); |
1091 ASSERT_TRUE(cache); | 1091 ASSERT_TRUE(cache); |
1092 EXPECT_FALSE(cache->GetExtension(kGoodExtensionID, NULL, NULL)); | 1092 EXPECT_FALSE(cache->GetExtension(kGoodExtensionID, NULL, NULL)); |
1093 } | 1093 } |
1094 | 1094 |
1095 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) { | 1095 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionsCached) { |
1096 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 1096 ASSERT_TRUE(embedded_test_server()->Start()); |
1097 | 1097 |
1098 // Pre-populate the device local account's extension cache with a hosted app | 1098 // Pre-populate the device local account's extension cache with a hosted app |
1099 // and an extension. | 1099 // and an extension. |
1100 EXPECT_TRUE(base::CreateDirectory( | 1100 EXPECT_TRUE(base::CreateDirectory( |
1101 GetExtensionCacheDirectoryForAccountID(kAccountId1))); | 1101 GetExtensionCacheDirectoryForAccountID(kAccountId1))); |
1102 base::FilePath test_dir; | 1102 base::FilePath test_dir; |
1103 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 1103 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
1104 const base::FilePath cached_hosted_app = | 1104 const base::FilePath cached_hosted_app = |
1105 GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion); | 1105 GetCacheCRXFile(kAccountId1, kHostedAppID, kHostedAppVersion); |
1106 EXPECT_TRUE(CopyFile(test_dir.Append(kHostedAppCRXPath), | 1106 EXPECT_TRUE(CopyFile(test_dir.Append(kHostedAppCRXPath), |
(...skipping 76 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1183 static void CreateFile(const base::FilePath& file, | 1183 static void CreateFile(const base::FilePath& file, |
1184 size_t size, | 1184 size_t size, |
1185 const base::Time& timestamp) { | 1185 const base::Time& timestamp) { |
1186 std::string data(size, 0); | 1186 std::string data(size, 0); |
1187 EXPECT_EQ(base::WriteFile(file, data.data(), data.size()), int(size)); | 1187 EXPECT_EQ(base::WriteFile(file, data.data(), data.size()), int(size)); |
1188 EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp)); | 1188 EXPECT_TRUE(base::TouchFile(file, timestamp, timestamp)); |
1189 } | 1189 } |
1190 | 1190 |
1191 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionCacheImplTest) { | 1191 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, ExtensionCacheImplTest) { |
1192 // Make it possible to force-install a hosted app and an extension. | 1192 // Make it possible to force-install a hosted app and an extension. |
1193 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 1193 ASSERT_TRUE(embedded_test_server()->Start()); |
1194 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( | 1194 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( |
1195 new TestingUpdateManifestProvider(kRelativeUpdateURL)); | 1195 new TestingUpdateManifestProvider(kRelativeUpdateURL)); |
1196 testing_update_manifest_provider->AddUpdate( | 1196 testing_update_manifest_provider->AddUpdate( |
1197 kHostedAppID, kHostedAppVersion, | 1197 kHostedAppID, kHostedAppVersion, |
1198 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); | 1198 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); |
1199 testing_update_manifest_provider->AddUpdate( | 1199 testing_update_manifest_provider->AddUpdate( |
1200 kGoodExtensionID, kGoodExtensionVersion, | 1200 kGoodExtensionID, kGoodExtensionVersion, |
1201 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); | 1201 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); |
1202 embedded_test_server()->RegisterRequestHandler( | 1202 embedded_test_server()->RegisterRequestHandler( |
1203 base::Bind(&TestingUpdateManifestProvider::HandleRequest, | 1203 base::Bind(&TestingUpdateManifestProvider::HandleRequest, |
(...skipping 167 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1371 &test::ExternalDataFetchCallback, | 1371 &test::ExternalDataFetchCallback, |
1372 &fetched_external_data, | 1372 &fetched_external_data, |
1373 run_loop->QuitClosure())); | 1373 run_loop->QuitClosure())); |
1374 run_loop->Run(); | 1374 run_loop->Run(); |
1375 | 1375 |
1376 ASSERT_TRUE(fetched_external_data); | 1376 ASSERT_TRUE(fetched_external_data); |
1377 EXPECT_EQ(kExternalData, *fetched_external_data); | 1377 EXPECT_EQ(kExternalData, *fetched_external_data); |
1378 } | 1378 } |
1379 | 1379 |
1380 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, UserAvatarImage) { | 1380 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, UserAvatarImage) { |
1381 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 1381 ASSERT_TRUE(embedded_test_server()->Start()); |
1382 | 1382 |
1383 UploadDeviceLocalAccountPolicy(); | 1383 UploadDeviceLocalAccountPolicy(); |
1384 AddPublicSessionToDevicePolicy(kAccountId1); | 1384 AddPublicSessionToDevicePolicy(kAccountId1); |
1385 | 1385 |
1386 WaitForPolicy(); | 1386 WaitForPolicy(); |
1387 | 1387 |
1388 base::FilePath test_dir; | 1388 base::FilePath test_dir; |
1389 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 1389 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
1390 std::string image_data; | 1390 std::string image_data; |
1391 ASSERT_TRUE(base::ReadFileToString( | 1391 ASSERT_TRUE(base::ReadFileToString( |
(...skipping 634 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2026 // Verify that the first recommended locale has been applied and the first | 2026 // Verify that the first recommended locale has been applied and the first |
2027 // keyboard layout applicable to the locale was chosen. | 2027 // keyboard layout applicable to the locale was chosen. |
2028 EXPECT_EQ(kRecommendedLocales1[0], g_browser_process->GetApplicationLocale()); | 2028 EXPECT_EQ(kRecommendedLocales1[0], g_browser_process->GetApplicationLocale()); |
2029 EXPECT_EQ(l10n_util::GetLanguage(kRecommendedLocales1[0]), | 2029 EXPECT_EQ(l10n_util::GetLanguage(kRecommendedLocales1[0]), |
2030 icu::Locale::getDefault().getLanguage()); | 2030 icu::Locale::getDefault().getLanguage()); |
2031 VerifyKeyboardLayoutMatchesLocale(); | 2031 VerifyKeyboardLayoutMatchesLocale(); |
2032 } | 2032 } |
2033 | 2033 |
2034 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) { | 2034 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, TermsOfServiceWithLocaleSwitch) { |
2035 // Specify Terms of Service URL. | 2035 // Specify Terms of Service URL. |
2036 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 2036 ASSERT_TRUE(embedded_test_server()->Start()); |
2037 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( | 2037 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( |
2038 embedded_test_server()->GetURL( | 2038 embedded_test_server()->GetURL( |
2039 std::string("/") + kExistentTermsOfServicePath).spec()); | 2039 std::string("/") + kExistentTermsOfServicePath).spec()); |
2040 UploadAndInstallDeviceLocalAccountPolicy(); | 2040 UploadAndInstallDeviceLocalAccountPolicy(); |
2041 AddPublicSessionToDevicePolicy(kAccountId1); | 2041 AddPublicSessionToDevicePolicy(kAccountId1); |
2042 | 2042 |
2043 WaitForPolicy(); | 2043 WaitForPolicy(); |
2044 | 2044 |
2045 // Select a different locale. | 2045 // Select a different locale. |
2046 ASSERT_TRUE(content::ExecuteScript( | 2046 ASSERT_TRUE(content::ExecuteScript( |
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2153 icu::Locale::getDefault().getLanguage()); | 2153 icu::Locale::getDefault().getLanguage()); |
2154 EXPECT_EQ(public_session_input_method_id_, | 2154 EXPECT_EQ(public_session_input_method_id_, |
2155 chromeos::input_method::InputMethodManager::Get() | 2155 chromeos::input_method::InputMethodManager::Get() |
2156 ->GetActiveIMEState() | 2156 ->GetActiveIMEState() |
2157 ->GetCurrentInputMethod() | 2157 ->GetCurrentInputMethod() |
2158 .id()); | 2158 .id()); |
2159 } | 2159 } |
2160 | 2160 |
2161 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, PolicyForExtensions) { | 2161 IN_PROC_BROWSER_TEST_F(DeviceLocalAccountTest, PolicyForExtensions) { |
2162 // Set up a test update server for the Show Managed Storage app. | 2162 // Set up a test update server for the Show Managed Storage app. |
2163 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 2163 ASSERT_TRUE(embedded_test_server()->Start()); |
2164 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( | 2164 scoped_refptr<TestingUpdateManifestProvider> testing_update_manifest_provider( |
2165 new TestingUpdateManifestProvider(kRelativeUpdateURL)); | 2165 new TestingUpdateManifestProvider(kRelativeUpdateURL)); |
2166 testing_update_manifest_provider->AddUpdate( | 2166 testing_update_manifest_provider->AddUpdate( |
2167 kShowManagedStorageID, kShowManagedStorageVersion, | 2167 kShowManagedStorageID, kShowManagedStorageVersion, |
2168 embedded_test_server()->GetURL(std::string("/") + | 2168 embedded_test_server()->GetURL(std::string("/") + |
2169 kShowManagedStorageCRXPath)); | 2169 kShowManagedStorageCRXPath)); |
2170 embedded_test_server()->RegisterRequestHandler( | 2170 embedded_test_server()->RegisterRequestHandler( |
2171 base::Bind(&TestingUpdateManifestProvider::HandleRequest, | 2171 base::Bind(&TestingUpdateManifestProvider::HandleRequest, |
2172 testing_update_manifest_provider)); | 2172 testing_update_manifest_provider)); |
2173 | 2173 |
(...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2259 &expected_new_value, | 2259 &expected_new_value, |
2260 policy_service->GetPolicies(ns).GetValue("string"))); | 2260 policy_service->GetPolicies(ns).GetValue("string"))); |
2261 } | 2261 } |
2262 | 2262 |
2263 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, | 2263 class TermsOfServiceDownloadTest : public DeviceLocalAccountTest, |
2264 public testing::WithParamInterface<bool> { | 2264 public testing::WithParamInterface<bool> { |
2265 }; | 2265 }; |
2266 | 2266 |
2267 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { | 2267 IN_PROC_BROWSER_TEST_P(TermsOfServiceDownloadTest, TermsOfServiceScreen) { |
2268 // Specify Terms of Service URL. | 2268 // Specify Terms of Service URL. |
2269 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady()); | 2269 ASSERT_TRUE(embedded_test_server()->Start()); |
2270 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( | 2270 device_local_account_policy_.payload().mutable_termsofserviceurl()->set_value( |
2271 embedded_test_server()->GetURL( | 2271 embedded_test_server()->GetURL( |
2272 std::string("/") + | 2272 std::string("/") + |
2273 (GetParam() ? kExistentTermsOfServicePath | 2273 (GetParam() ? kExistentTermsOfServicePath |
2274 : kNonexistentTermsOfServicePath)).spec()); | 2274 : kNonexistentTermsOfServicePath)).spec()); |
2275 UploadAndInstallDeviceLocalAccountPolicy(); | 2275 UploadAndInstallDeviceLocalAccountPolicy(); |
2276 AddPublicSessionToDevicePolicy(kAccountId1); | 2276 AddPublicSessionToDevicePolicy(kAccountId1); |
2277 | 2277 |
2278 WaitForPolicy(); | 2278 WaitForPolicy(); |
2279 | 2279 |
(...skipping 105 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2385 ASSERT_TRUE(content::ExecuteScript(contents_, | 2385 ASSERT_TRUE(content::ExecuteScript(contents_, |
2386 "$('tos-accept-button').click();")); | 2386 "$('tos-accept-button').click();")); |
2387 | 2387 |
2388 WaitForSessionStart(); | 2388 WaitForSessionStart(); |
2389 } | 2389 } |
2390 | 2390 |
2391 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2391 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2392 TermsOfServiceDownloadTest, testing::Bool()); | 2392 TermsOfServiceDownloadTest, testing::Bool()); |
2393 | 2393 |
2394 } // namespace policy | 2394 } // namespace policy |
OLD | NEW |