Fixed PolicyLoaderIOS unit tests on iOS 6.1.

These tests and the feature that they test rely on iOS 7 APIs.
This change skips those tests if the platform is not recent enough.

BUG=348820

Review URL: https://codereview.chromium.org/213703005

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@260460 0039d316-1c4b-4281-b951-d872f2087c98
parent 487622d0
......@@ -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",
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment