OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "chrome/common/extensions/api/extension_api.h" | 5 #include "chrome/common/extensions/api/extension_api.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/file_path.h" | 10 #include "base/file_path.h" |
(...skipping 402 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
413 | 413 |
414 Feature* feature = api.GetFeature("test"); | 414 Feature* feature = api.GetFeature("test"); |
415 EXPECT_EQ(test_data[i].expect_success, feature != NULL) << i; | 415 EXPECT_EQ(test_data[i].expect_success, feature != NULL) << i; |
416 } | 416 } |
417 } | 417 } |
418 | 418 |
419 static void GetDictionaryFromList(const DictionaryValue* schema, | 419 static void GetDictionaryFromList(const DictionaryValue* schema, |
420 const std::string& list_name, | 420 const std::string& list_name, |
421 const int list_index, | 421 const int list_index, |
422 DictionaryValue** out) { | 422 DictionaryValue** out) { |
423 ListValue* list; | 423 const ListValue* list; |
424 EXPECT_TRUE(schema->GetList(list_name, &list)); | 424 EXPECT_TRUE(schema->GetList(list_name, &list)); |
425 EXPECT_TRUE(list->GetDictionary(list_index, out)); | 425 EXPECT_TRUE(list->GetDictionary(list_index, out)); |
426 } | 426 } |
427 | 427 |
428 TEST(ExtensionAPI, TypesHaveNamespace) { | 428 TEST(ExtensionAPI, TypesHaveNamespace) { |
429 FilePath manifest_path; | 429 FilePath manifest_path; |
430 PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); | 430 PathService::Get(chrome::DIR_TEST_DATA, &manifest_path); |
431 manifest_path = manifest_path.AppendASCII("extensions") | 431 manifest_path = manifest_path.AppendASCII("extensions") |
432 .AppendASCII("extension_api_unittest") | 432 .AppendASCII("extension_api_unittest") |
433 .AppendASCII("types_have_namespace.json"); | 433 .AppendASCII("types_have_namespace.json"); |
(...skipping 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
480 GetDictionaryFromList(dict, "parameters", 0, &sub_dict); | 480 GetDictionaryFromList(dict, "parameters", 0, &sub_dict); |
481 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); | 481 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
482 EXPECT_EQ("test.foo.TestType", type); | 482 EXPECT_EQ("test.foo.TestType", type); |
483 GetDictionaryFromList(dict, "parameters", 1, &sub_dict); | 483 GetDictionaryFromList(dict, "parameters", 1, &sub_dict); |
484 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); | 484 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
485 EXPECT_EQ("fully.qualified.Type", type); | 485 EXPECT_EQ("fully.qualified.Type", type); |
486 } | 486 } |
487 | 487 |
488 } // namespace | 488 } // namespace |
489 } // namespace extensions | 489 } // namespace extensions |
OLD | NEW |