Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(659)

Unified Diff: components/policy/core/common/policy_loader_ios_unittest.mm

Issue 213703005: Fixed PolicyLoaderIOS unit tests on iOS 6.1. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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",
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698