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

Side by Side Diff: chrome/common/extensions/api/extension_api_unittest.cc

Issue 13145003: Rewrite std::string("") to std::string(), Linux edition. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Ugh Created 7 years, 8 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 unified diff | Download patch | Annotate | Revision Log
OLDNEW
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_util.h" 10 #include "base/file_util.h"
(...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after
90 scoped_ptr<ExtensionAPI> extension_api( 90 scoped_ptr<ExtensionAPI> extension_api(
91 ExtensionAPI::CreateWithDefaultConfiguration()); 91 ExtensionAPI::CreateWithDefaultConfiguration());
92 92
93 EXPECT_FALSE(extension_api->IsPrivileged("runtime.connect")); 93 EXPECT_FALSE(extension_api->IsPrivileged("runtime.connect"));
94 EXPECT_FALSE(extension_api->IsPrivileged("runtime.onConnect")); 94 EXPECT_FALSE(extension_api->IsPrivileged("runtime.onConnect"));
95 95
96 // Properties are not supported yet. 96 // Properties are not supported yet.
97 EXPECT_TRUE(extension_api->IsPrivileged("runtime.lastError")); 97 EXPECT_TRUE(extension_api->IsPrivileged("runtime.lastError"));
98 98
99 // Default unknown names to privileged for paranoia's sake. 99 // Default unknown names to privileged for paranoia's sake.
100 EXPECT_TRUE(extension_api->IsPrivileged("")); 100 EXPECT_TRUE(extension_api->IsPrivileged(std::string()));
101 EXPECT_TRUE(extension_api->IsPrivileged("<unknown-namespace>")); 101 EXPECT_TRUE(extension_api->IsPrivileged("<unknown-namespace>"));
102 EXPECT_TRUE(extension_api->IsPrivileged("extension.<unknown-member>")); 102 EXPECT_TRUE(extension_api->IsPrivileged("extension.<unknown-member>"));
103 103
104 // Exists, but privileged. 104 // Exists, but privileged.
105 EXPECT_TRUE(extension_api->IsPrivileged("extension.getViews")); 105 EXPECT_TRUE(extension_api->IsPrivileged("extension.getViews"));
106 EXPECT_TRUE(extension_api->IsPrivileged("history.search")); 106 EXPECT_TRUE(extension_api->IsPrivileged("history.search"));
107 107
108 // Whole APIs that are unprivileged. 108 // Whole APIs that are unprivileged.
109 EXPECT_FALSE(extension_api->IsPrivileged("app.getDetails")); 109 EXPECT_FALSE(extension_api->IsPrivileged("app.getDetails"));
110 EXPECT_FALSE(extension_api->IsPrivileged("app.isInstalled")); 110 EXPECT_FALSE(extension_api->IsPrivileged("app.isInstalled"));
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
217 api.IsAvailable(test_data[i].api_full_name, 217 api.IsAvailable(test_data[i].api_full_name,
218 NULL, 218 NULL,
219 test_data[i].context, 219 test_data[i].context,
220 test_data[i].url).is_available()) << i; 220 test_data[i].url).is_available()) << i;
221 } 221 }
222 } 222 }
223 223
224 TEST_F(ExtensionAPITest, LazyGetSchema) { 224 TEST_F(ExtensionAPITest, LazyGetSchema) {
225 scoped_ptr<ExtensionAPI> apis(ExtensionAPI::CreateWithDefaultConfiguration()); 225 scoped_ptr<ExtensionAPI> apis(ExtensionAPI::CreateWithDefaultConfiguration());
226 226
227 EXPECT_EQ(NULL, apis->GetSchema("")); 227 EXPECT_EQ(NULL, apis->GetSchema(std::string()));
228 EXPECT_EQ(NULL, apis->GetSchema("")); 228 EXPECT_EQ(NULL, apis->GetSchema(std::string()));
229 EXPECT_EQ(NULL, apis->GetSchema("experimental")); 229 EXPECT_EQ(NULL, apis->GetSchema("experimental"));
230 EXPECT_EQ(NULL, apis->GetSchema("experimental")); 230 EXPECT_EQ(NULL, apis->GetSchema("experimental"));
231 EXPECT_EQ(NULL, apis->GetSchema("foo")); 231 EXPECT_EQ(NULL, apis->GetSchema("foo"));
232 EXPECT_EQ(NULL, apis->GetSchema("foo")); 232 EXPECT_EQ(NULL, apis->GetSchema("foo"));
233 233
234 EXPECT_TRUE(apis->GetSchema("experimental.dns")); 234 EXPECT_TRUE(apis->GetSchema("experimental.dns"));
235 EXPECT_TRUE(apis->GetSchema("experimental.dns")); 235 EXPECT_TRUE(apis->GetSchema("experimental.dns"));
236 EXPECT_TRUE(apis->GetSchema("experimental.infobars")); 236 EXPECT_TRUE(apis->GetSchema("experimental.infobars"));
237 EXPECT_TRUE(apis->GetSchema("experimental.infobars")); 237 EXPECT_TRUE(apis->GetSchema("experimental.infobars"));
238 EXPECT_TRUE(apis->GetSchema("extension")); 238 EXPECT_TRUE(apis->GetSchema("extension"));
(...skipping 313 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 GetDictionaryFromList(dict, "parameters", 0, &sub_dict); 552 GetDictionaryFromList(dict, "parameters", 0, &sub_dict);
553 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); 553 EXPECT_TRUE(sub_dict->GetString("$ref", &type));
554 EXPECT_EQ("test.foo.TestType", type); 554 EXPECT_EQ("test.foo.TestType", type);
555 GetDictionaryFromList(dict, "parameters", 1, &sub_dict); 555 GetDictionaryFromList(dict, "parameters", 1, &sub_dict);
556 EXPECT_TRUE(sub_dict->GetString("$ref", &type)); 556 EXPECT_TRUE(sub_dict->GetString("$ref", &type));
557 EXPECT_EQ("fully.qualified.Type", type); 557 EXPECT_EQ("fully.qualified.Type", type);
558 } 558 }
559 559
560 } // namespace 560 } // namespace
561 } // namespace extensions 561 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/common/extensions/api/extension_api.cc ('k') | chrome/common/extensions/csp_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698