OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 <jni.h> | 5 #include <jni.h> |
6 | 6 |
7 #include "base/android/jni_android.h" | 7 #include "base/android/jni_android.h" |
8 #include "base/android/jni_string.h" | 8 #include "base/android/jni_string.h" |
9 #include "base/android/scoped_java_ref.h" | 9 #include "base/android/scoped_java_ref.h" |
10 #include "base/values.h" | 10 #include "base/values.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
70 ConvertUTF8ToJavaString(env, "TestPolicy"); | 70 ConvertUTF8ToJavaString(env, "TestPolicy"); |
71 ScopedJavaLocalRef<jstring> jvalue = | 71 ScopedJavaLocalRef<jstring> jvalue = |
72 ConvertUTF8ToJavaString(env, "TestValue"); | 72 ConvertUTF8ToJavaString(env, "TestValue"); |
73 manager.GetPolicyConverterForTesting()->SetPolicyString(env, nullptr, jpolicy, | 73 manager.GetPolicyConverterForTesting()->SetPolicyString(env, nullptr, jpolicy, |
74 jvalue); | 74 jvalue); |
75 manager.FlushPolicies(env, nullptr); | 75 manager.FlushPolicies(env, nullptr); |
76 const PolicyBundle& bundle = manager.policies(); | 76 const PolicyBundle& bundle = manager.policies(); |
77 const PolicyMap& map = bundle.Get(ns); | 77 const PolicyMap& map = bundle.Get(ns); |
78 const base::Value* value = map.GetValue("TestPolicy"); | 78 const base::Value* value = map.GetValue("TestPolicy"); |
79 ASSERT_NE(nullptr, value); | 79 ASSERT_NE(nullptr, value); |
80 EXPECT_EQ(base::Value::TYPE_STRING, value->GetType()); | 80 EXPECT_EQ(base::Value::Type::STRING, value->GetType()); |
81 std::string out_value; | 81 std::string out_value; |
82 EXPECT_TRUE(value->GetAsString(&out_value)); | 82 EXPECT_TRUE(value->GetAsString(&out_value)); |
83 EXPECT_EQ("TestValue", out_value); | 83 EXPECT_EQ("TestValue", out_value); |
84 // If the manager is deleted (by going out of scope) without being shutdown | 84 // If the manager is deleted (by going out of scope) without being shutdown |
85 // first it DCHECKs. | 85 // first it DCHECKs. |
86 manager.Shutdown(); | 86 manager.Shutdown(); |
87 } | 87 } |
88 | 88 |
89 } // namespace android | 89 } // namespace android |
90 | 90 |
91 } // namespace policy | 91 } // namespace policy |
OLD | NEW |