OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <gtest/gtest.h> | 5 #include <gtest/gtest.h> |
6 #include <windows.h> | 6 #include <windows.h> |
7 | 7 |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
10 #include "base/stl_util.h" | 10 #include "base/stl_util.h" |
(...skipping 254 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
265 } | 265 } |
266 case Value::TYPE_LIST: { | 266 case Value::TYPE_LIST: { |
267 const ListValue* list = static_cast<const ListValue*>(value); | 267 const ListValue* list = static_cast<const ListValue*>(value); |
268 RegKey key(hive, | 268 RegKey key(hive, |
269 (string16(policy::kRegistrySubKey) + ASCIIToUTF16("\\") + | 269 (string16(policy::kRegistrySubKey) + ASCIIToUTF16("\\") + |
270 UTF8ToUTF16(name)).c_str(), | 270 UTF8ToUTF16(name)).c_str(), |
271 KEY_ALL_ACCESS); | 271 KEY_ALL_ACCESS); |
272 int index = 1; | 272 int index = 1; |
273 for (ListValue::const_iterator element(list->begin()); | 273 for (ListValue::const_iterator element(list->begin()); |
274 element != list->end(); ++element) { | 274 element != list->end(); ++element) { |
275 ASSERT_TRUE((*element)->IsType(Value::TYPE_STRING)); | 275 ASSERT_TRUE((*element)->IsString()); |
276 std::string element_value; | 276 std::string element_value; |
277 ASSERT_TRUE((*element)->GetAsString(&element_value)); | 277 ASSERT_TRUE((*element)->GetAsString(&element_value)); |
278 key.WriteValue(base::IntToString16(index++).c_str(), | 278 key.WriteValue(base::IntToString16(index++).c_str(), |
279 UTF8ToUTF16(element_value).c_str()); | 279 UTF8ToUTF16(element_value).c_str()); |
280 } | 280 } |
281 break; | 281 break; |
282 } | 282 } |
283 default: | 283 default: |
284 FAIL() << "Unsupported value type " << value->GetType(); | 284 FAIL() << "Unsupported value type " << value->GetType(); |
285 break; | 285 break; |
286 } | 286 } |
287 } | 287 } |
288 | 288 |
289 void ConfigurationPolicyProviderWinTest::WriteInvalidValue(HKEY hive, | 289 void ConfigurationPolicyProviderWinTest::WriteInvalidValue(HKEY hive, |
290 const char* name, | 290 const char* name, |
291 const Value* value) { | 291 const Value* value) { |
292 if (value->IsType(Value::TYPE_STRING)) | 292 if (value->IsString()) |
293 WriteDWORD(hive, name, -1); | 293 WriteDWORD(hive, name, -1); |
294 else | 294 else |
295 WriteString(hive, name, L"bad value"); | 295 WriteString(hive, name, L"bad value"); |
296 } | 296 } |
297 | 297 |
298 TEST_P(ConfigurationPolicyProviderWinTest, Default) { | 298 TEST_P(ConfigurationPolicyProviderWinTest, Default) { |
299 provider_->Provide(store_.get()); | 299 provider_->Provide(store_.get()); |
300 EXPECT_TRUE(store_->policy_map().empty()); | 300 EXPECT_TRUE(store_->policy_map().empty()); |
301 } | 301 } |
302 | 302 |
(...skipping 199 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
502 kPolicyDisabledSchemes, | 502 kPolicyDisabledSchemes, |
503 key::kDisabledSchemes), | 503 key::kDisabledSchemes), |
504 PolicyTestParams::ForStringPolicy( | 504 PolicyTestParams::ForStringPolicy( |
505 kPolicyDiskCacheDir, | 505 kPolicyDiskCacheDir, |
506 key::kDiskCacheDir), | 506 key::kDiskCacheDir), |
507 PolicyTestParams::ForIntegerPolicy( | 507 PolicyTestParams::ForIntegerPolicy( |
508 kPolicyMaxConnectionsPerProxy, | 508 kPolicyMaxConnectionsPerProxy, |
509 key::kMaxConnectionsPerProxy))); | 509 key::kMaxConnectionsPerProxy))); |
510 | 510 |
511 } // namespace policy | 511 } // namespace policy |
OLD | NEW |