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 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
90 &feature_name); | 90 &feature_name); |
91 EXPECT_EQ(test_data[i].expected_feature_type, feature_type) << i; | 91 EXPECT_EQ(test_data[i].expected_feature_type, feature_type) << i; |
92 EXPECT_EQ(test_data[i].expected_feature_name, feature_name) << i; | 92 EXPECT_EQ(test_data[i].expected_feature_name, feature_name) << i; |
93 } | 93 } |
94 } | 94 } |
95 | 95 |
96 TEST(ExtensionAPI, IsPrivileged) { | 96 TEST(ExtensionAPI, IsPrivileged) { |
97 scoped_ptr<ExtensionAPI> extension_api( | 97 scoped_ptr<ExtensionAPI> extension_api( |
98 ExtensionAPI::CreateWithDefaultConfiguration()); | 98 ExtensionAPI::CreateWithDefaultConfiguration()); |
99 | 99 |
100 EXPECT_FALSE(extension_api->IsPrivileged("extension.connect")); | 100 EXPECT_FALSE(extension_api->IsPrivileged("runtime.connect")); |
101 EXPECT_FALSE(extension_api->IsPrivileged("extension.onConnect")); | 101 EXPECT_FALSE(extension_api->IsPrivileged("runtime.onConnect")); |
102 | 102 |
103 // Properties are not supported yet. | 103 // Properties are not supported yet. |
104 EXPECT_TRUE(extension_api->IsPrivileged("extension.lastError")); | 104 EXPECT_TRUE(extension_api->IsPrivileged("runtime.lastError")); |
105 | 105 |
106 // Default unknown names to privileged for paranoia's sake. | 106 // Default unknown names to privileged for paranoia's sake. |
107 EXPECT_TRUE(extension_api->IsPrivileged("")); | 107 EXPECT_TRUE(extension_api->IsPrivileged("")); |
108 EXPECT_TRUE(extension_api->IsPrivileged("<unknown-namespace>")); | 108 EXPECT_TRUE(extension_api->IsPrivileged("<unknown-namespace>")); |
109 EXPECT_TRUE(extension_api->IsPrivileged("extension.<unknown-member>")); | 109 EXPECT_TRUE(extension_api->IsPrivileged("extension.<unknown-member>")); |
110 | 110 |
111 // Exists, but privileged. | 111 // Exists, but privileged. |
112 EXPECT_TRUE(extension_api->IsPrivileged("extension.getViews")); | 112 EXPECT_TRUE(extension_api->IsPrivileged("extension.getViews")); |
113 EXPECT_TRUE(extension_api->IsPrivileged("history.search")); | 113 EXPECT_TRUE(extension_api->IsPrivileged("history.search")); |
114 | 114 |
(...skipping 367 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
482 GetDictionaryFromList(dict, "parameters", 0, &sub_dict); | 482 GetDictionaryFromList(dict, "parameters", 0, &sub_dict); |
483 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); | 483 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
484 EXPECT_EQ("test.foo.TestType", type); | 484 EXPECT_EQ("test.foo.TestType", type); |
485 GetDictionaryFromList(dict, "parameters", 1, &sub_dict); | 485 GetDictionaryFromList(dict, "parameters", 1, &sub_dict); |
486 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); | 486 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); |
487 EXPECT_EQ("fully.qualified.Type", type); | 487 EXPECT_EQ("fully.qualified.Type", type); |
488 } | 488 } |
489 | 489 |
490 } // namespace | 490 } // namespace |
491 } // namespace extensions | 491 } // namespace extensions |
OLD | NEW |