| 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 1834 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1845 LoadUnpackedExtension(kAppUnpackedExt, true); | 1845 LoadUnpackedExtension(kAppUnpackedExt, true); |
| 1846 | 1846 |
| 1847 const std::string old_version_number = | 1847 const std::string old_version_number = |
| 1848 service->GetExtensionById(kGoodCrxId, true)->version()->GetString(); | 1848 service->GetExtensionById(kGoodCrxId, true)->version()->GetString(); |
| 1849 | 1849 |
| 1850 base::FilePath test_path; | 1850 base::FilePath test_path; |
| 1851 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); | 1851 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); |
| 1852 | 1852 |
| 1853 TestRequestInterceptor interceptor( | 1853 TestRequestInterceptor interceptor( |
| 1854 "update.extension", | 1854 "update.extension", |
| 1855 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 1855 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 1856 interceptor.PushJobCallback( | 1856 interceptor.PushJobCallback( |
| 1857 TestRequestInterceptor::FileJob( | 1857 TestRequestInterceptor::FileJob( |
| 1858 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); | 1858 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); |
| 1859 | 1859 |
| 1860 // Updating the force-installed extension. | 1860 // Updating the force-installed extension. |
| 1861 extensions::ExtensionUpdater* updater = service->updater(); | 1861 extensions::ExtensionUpdater* updater = service->updater(); |
| 1862 extensions::ExtensionUpdater::CheckParams params; | 1862 extensions::ExtensionUpdater::CheckParams params; |
| 1863 params.install_immediately = true; | 1863 params.install_immediately = true; |
| 1864 extensions::TestExtensionRegistryObserver update_observer( | 1864 extensions::TestExtensionRegistryObserver update_observer( |
| 1865 extensions::ExtensionRegistry::Get(browser()->profile())); | 1865 extensions::ExtensionRegistry::Get(browser()->profile())); |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2056 extensions::ExtensionPrefs::Get(browser()->profile()); | 2056 extensions::ExtensionPrefs::Get(browser()->profile()); |
| 2057 | 2057 |
| 2058 // Explicitly stop the timer to avoid all scheduled extension auto-updates. | 2058 // Explicitly stop the timer to avoid all scheduled extension auto-updates. |
| 2059 service->updater()->StopTimerForTesting(); | 2059 service->updater()->StopTimerForTesting(); |
| 2060 | 2060 |
| 2061 // Setup interceptor for extension updates. | 2061 // Setup interceptor for extension updates. |
| 2062 base::FilePath test_path; | 2062 base::FilePath test_path; |
| 2063 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); | 2063 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); |
| 2064 TestRequestInterceptor interceptor( | 2064 TestRequestInterceptor interceptor( |
| 2065 "update.extension", | 2065 "update.extension", |
| 2066 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 2066 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 2067 interceptor.PushJobCallback(TestRequestInterceptor::BadRequestJob()); | 2067 interceptor.PushJobCallback(TestRequestInterceptor::BadRequestJob()); |
| 2068 interceptor.PushJobCallback(TestRequestInterceptor::FileJob( | 2068 interceptor.PushJobCallback(TestRequestInterceptor::FileJob( |
| 2069 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); | 2069 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); |
| 2070 | 2070 |
| 2071 // Install the extension. | 2071 // Install the extension. |
| 2072 EXPECT_TRUE(InstallExtension(kGoodV1CrxName)); | 2072 EXPECT_TRUE(InstallExtension(kGoodV1CrxName)); |
| 2073 EXPECT_TRUE(registry->enabled_extensions().Contains(kGoodCrxId)); | 2073 EXPECT_TRUE(registry->enabled_extensions().Contains(kGoodCrxId)); |
| 2074 | 2074 |
| 2075 // Update policy to set a minimum version of 1.0.0.0, the extension (with | 2075 // Update policy to set a minimum version of 1.0.0.0, the extension (with |
| 2076 // version 1.0.0.0) should still be enabled. | 2076 // version 1.0.0.0) should still be enabled. |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 2126 extensions::ExtensionPrefs::Get(browser()->profile()); | 2126 extensions::ExtensionPrefs::Get(browser()->profile()); |
| 2127 | 2127 |
| 2128 // Explicitly stop the timer to avoid all scheduled extension auto-updates. | 2128 // Explicitly stop the timer to avoid all scheduled extension auto-updates. |
| 2129 service->updater()->StopTimerForTesting(); | 2129 service->updater()->StopTimerForTesting(); |
| 2130 | 2130 |
| 2131 // Setup interceptor for extension updates. | 2131 // Setup interceptor for extension updates. |
| 2132 base::FilePath test_path; | 2132 base::FilePath test_path; |
| 2133 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); | 2133 ASSERT_TRUE(PathService::Get(chrome::DIR_TEST_DATA, &test_path)); |
| 2134 TestRequestInterceptor interceptor( | 2134 TestRequestInterceptor interceptor( |
| 2135 "update.extension", | 2135 "update.extension", |
| 2136 BrowserThread::GetMessageLoopProxyForThread(BrowserThread::IO)); | 2136 BrowserThread::GetTaskRunnerForThread(BrowserThread::IO)); |
| 2137 interceptor.PushJobCallback(TestRequestInterceptor::FileJob( | 2137 interceptor.PushJobCallback(TestRequestInterceptor::FileJob( |
| 2138 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); | 2138 test_path.Append(kTestExtensionsDir).Append(kGood2CrxManifestName))); |
| 2139 | 2139 |
| 2140 // Set the policy to require an even higher minimum version this time. | 2140 // Set the policy to require an even higher minimum version this time. |
| 2141 { | 2141 { |
| 2142 extensions::ExtensionManagementPolicyUpdater management_policy(&provider_); | 2142 extensions::ExtensionManagementPolicyUpdater management_policy(&provider_); |
| 2143 management_policy.SetMinimumVersionRequired(kGoodCrxId, "1.0.0.2"); | 2143 management_policy.SetMinimumVersionRequired(kGoodCrxId, "1.0.0.2"); |
| 2144 } | 2144 } |
| 2145 base::RunLoop().RunUntilIdle(); | 2145 base::RunLoop().RunUntilIdle(); |
| 2146 | 2146 |
| (...skipping 1960 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 4107 | 4107 |
| 4108 SetEmptyPolicy(); | 4108 SetEmptyPolicy(); |
| 4109 // Policy not set. | 4109 // Policy not set. |
| 4110 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); | 4110 CheckSystemTimezoneAutomaticDetectionPolicyUnset(); |
| 4111 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); | 4111 EXPECT_TRUE(CheckResolveTimezoneByGeolocation(true, false)); |
| 4112 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); | 4112 EXPECT_TRUE(manager->TimeZoneResolverShouldBeRunningForTests()); |
| 4113 } | 4113 } |
| 4114 #endif // defined(OS_CHROMEOS) | 4114 #endif // defined(OS_CHROMEOS) |
| 4115 | 4115 |
| 4116 } // namespace policy | 4116 } // namespace policy |
| OLD | NEW |