Index: components/policy/core/common/policy_loader_ios_unittest.mm |
diff --git a/components/policy/core/common/policy_loader_ios_unittest.mm b/components/policy/core/common/policy_loader_ios_unittest.mm |
index 7b85dc8c4708ee19432c867e01802f386f8bcadc..e73a2696f589e712dcb813fb157e97b4e0cd5875 100644 |
--- a/components/policy/core/common/policy_loader_ios_unittest.mm |
+++ b/components/policy/core/common/policy_loader_ios_unittest.mm |
@@ -7,6 +7,7 @@ |
#include "base/basictypes.h" |
#include "base/callback.h" |
#include "base/files/file_path.h" |
+#include "base/ios/ios_util.h" |
#include "base/strings/sys_string_conversions.h" |
#include "base/test/test_simple_task_runner.h" |
#include "base/values.h" |
@@ -144,7 +145,13 @@ PolicyProviderTestHarness* TestHarness::Create() { |
// static |
PolicyProviderTestHarness* TestHarness::CreateWithEncodedKey() { |
- return new TestHarness(true); |
+ if (base::ios::IsRunningOnIOS7OrLater()) |
+ return new TestHarness(true); |
+ // Earlier versions of iOS don't have the APIs to support this test. |
+ // Unfortunately it's not possible to conditionally run this harness using |
+ // gtest, so we just fallback to running the non-encoded version. |
+ NSLog(@"Skipping test"); |
+ return new TestHarness(false); |
} |
void TestHarness::AddPolicies(NSDictionary* policy) { |
@@ -224,6 +231,12 @@ TEST(PolicyProviderIOSTest, ChromePolicyOverEncodedChromePolicy) { |
// This test verifies that if the "ChromePolicy" key is present then the |
// "EncodedChromePolicy" key is ignored. |
+ if (!base::ios::IsRunningOnIOS7OrLater()) { |
+ // Skip this test if running on a version earlier than iOS 7. |
+ NSLog(@"Skipping test"); |
+ return; |
+ } |
+ |
NSDictionary* policy = @{ |
@"shared": @"wrong", |
@"key1": @"value1", |