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 "chrome/browser/chromeos/policy/device_local_account.h" | 5 #include "chrome/browser/chromeos/policy/device_local_account.h" |
6 | 6 |
7 #include <stddef.h> | 7 #include <stddef.h> |
8 | 8 |
9 #include <map> | 9 #include <map> |
10 #include <memory> | 10 #include <memory> |
(...skipping 1249 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1260 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); | 1260 embedded_test_server()->GetURL(std::string("/") + kHostedAppCRXPath)); |
1261 testing_update_manifest_provider->AddUpdate( | 1261 testing_update_manifest_provider->AddUpdate( |
1262 kGoodExtensionID, kGoodExtensionVersion, | 1262 kGoodExtensionID, kGoodExtensionVersion, |
1263 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); | 1263 embedded_test_server()->GetURL(std::string("/") + kGoodExtensionCRXPath)); |
1264 embedded_test_server()->RegisterRequestHandler( | 1264 embedded_test_server()->RegisterRequestHandler( |
1265 base::Bind(&TestingUpdateManifestProvider::HandleRequest, | 1265 base::Bind(&TestingUpdateManifestProvider::HandleRequest, |
1266 testing_update_manifest_provider)); | 1266 testing_update_manifest_provider)); |
1267 // Create and initialize local cache. | 1267 // Create and initialize local cache. |
1268 base::ScopedTempDir cache_dir; | 1268 base::ScopedTempDir cache_dir; |
1269 EXPECT_TRUE(cache_dir.CreateUniqueTempDir()); | 1269 EXPECT_TRUE(cache_dir.CreateUniqueTempDir()); |
1270 const base::FilePath impl_path = cache_dir.path(); | 1270 const base::FilePath impl_path = cache_dir.GetPath(); |
1271 EXPECT_TRUE(base::CreateDirectory(impl_path)); | 1271 EXPECT_TRUE(base::CreateDirectory(impl_path)); |
1272 CreateFile(impl_path.Append( | 1272 CreateFile(impl_path.Append( |
1273 extensions::LocalExtensionCache::kCacheReadyFlagFileName), | 1273 extensions::LocalExtensionCache::kCacheReadyFlagFileName), |
1274 0, base::Time::Now()); | 1274 0, base::Time::Now()); |
1275 extensions::ExtensionCacheImpl cache_impl( | 1275 extensions::ExtensionCacheImpl cache_impl( |
1276 base::MakeUnique<extensions::ChromeOSExtensionCacheDelegate>(impl_path)); | 1276 base::MakeUnique<extensions::ChromeOSExtensionCacheDelegate>(impl_path)); |
1277 std::unique_ptr<base::RunLoop> run_loop; | 1277 std::unique_ptr<base::RunLoop> run_loop; |
1278 run_loop.reset(new base::RunLoop); | 1278 run_loop.reset(new base::RunLoop); |
1279 cache_impl.Start(base::Bind(&OnExtensionCacheImplInitialized, &run_loop)); | 1279 cache_impl.Start(base::Bind(&OnExtensionCacheImplInitialized, &run_loop)); |
1280 run_loop->Run(); | 1280 run_loop->Run(); |
1281 | 1281 |
1282 // Put extension in the local cache. | 1282 // Put extension in the local cache. |
1283 base::ScopedTempDir temp_dir; | 1283 base::ScopedTempDir temp_dir; |
1284 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); | 1284 EXPECT_TRUE(temp_dir.CreateUniqueTempDir()); |
1285 const base::FilePath temp_path = temp_dir.path(); | 1285 const base::FilePath temp_path = temp_dir.GetPath(); |
1286 EXPECT_TRUE(base::CreateDirectory(temp_path)); | 1286 EXPECT_TRUE(base::CreateDirectory(temp_path)); |
1287 const base::FilePath temp_file = | 1287 const base::FilePath temp_file = |
1288 GetCacheCRXFilePath(kGoodExtensionID, kGoodExtensionVersion, temp_path); | 1288 GetCacheCRXFilePath(kGoodExtensionID, kGoodExtensionVersion, temp_path); |
1289 base::FilePath test_dir; | 1289 base::FilePath test_dir; |
1290 std::string hash; | 1290 std::string hash; |
1291 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); | 1291 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_dir)); |
1292 EXPECT_TRUE(CopyFile(test_dir.Append(kGoodExtensionCRXPath), temp_file)); | 1292 EXPECT_TRUE(CopyFile(test_dir.Append(kGoodExtensionCRXPath), temp_file)); |
1293 cache_impl.AllowCaching(kGoodExtensionID); | 1293 cache_impl.AllowCaching(kGoodExtensionID); |
1294 run_loop.reset(new base::RunLoop); | 1294 run_loop.reset(new base::RunLoop); |
1295 cache_impl.PutExtension(kGoodExtensionID, hash, temp_file, | 1295 cache_impl.PutExtension(kGoodExtensionID, hash, temp_file, |
(...skipping 1148 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2444 ASSERT_TRUE(content::ExecuteScript(contents_, | 2444 ASSERT_TRUE(content::ExecuteScript(contents_, |
2445 "$('tos-accept-button').click();")); | 2445 "$('tos-accept-button').click();")); |
2446 | 2446 |
2447 WaitForSessionStart(); | 2447 WaitForSessionStart(); |
2448 } | 2448 } |
2449 | 2449 |
2450 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, | 2450 INSTANTIATE_TEST_CASE_P(TermsOfServiceDownloadTestInstance, |
2451 TermsOfServiceDownloadTest, testing::Bool()); | 2451 TermsOfServiceDownloadTest, testing::Bool()); |
2452 | 2452 |
2453 } // namespace policy | 2453 } // namespace policy |
OLD | NEW |