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

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

Issue 443723003: extensions: Register 'app' and 'webstore' bindings only if they are available. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: . Created 6 years, 4 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 "extensions/common/extension_api.h" 5 #include "extensions/common/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 158 matching lines...) Expand 10 before | Expand all | Expand 10 after
169 169
170 scoped_refptr<Extension> extension = 170 scoped_refptr<Extension> extension =
171 BuildExtension(ExtensionBuilder().Pass()).Build(); 171 BuildExtension(ExtensionBuilder().Pass()).Build();
172 172
173 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) { 173 for (size_t i = 0; i < ARRAYSIZE_UNSAFE(test_data); ++i) {
174 ExtensionAPI api; 174 ExtensionAPI api;
175 api.RegisterDependencyProvider("api", &api_feature_provider); 175 api.RegisterDependencyProvider("api", &api_feature_provider);
176 EXPECT_EQ(test_data[i].expect_is_available, 176 EXPECT_EQ(test_data[i].expect_is_available,
177 api.IsAvailableInUntrustedContext(test_data[i].api_full_name, 177 api.IsAvailableInUntrustedContext(test_data[i].api_full_name,
178 extension.get())) 178 extension.get()))
179 << i; 179 << "API: " << test_data[i].api_full_name;
180 } 180 }
181 } 181 }
182 182
183 TEST(ExtensionAPITest, APIFeatures) { 183 TEST(ExtensionAPITest, APIFeatures) {
184 struct { 184 struct {
185 std::string api_full_name; 185 std::string api_full_name;
186 bool expect_is_available; 186 bool expect_is_available;
187 Feature::Context context; 187 Feature::Context context;
188 GURL url; 188 GURL url;
189 } test_data[] = { 189 } test_data[] = {
(...skipping 737 matching lines...) Expand 10 before | Expand all | Expand 10 after
927 extension.get(), 927 extension.get(),
928 Feature::BLESSED_EXTENSION_CONTEXT, 928 Feature::BLESSED_EXTENSION_CONTEXT,
929 GURL()).is_available()); 929 GURL()).is_available());
930 EXPECT_FALSE(extension_api->IsAvailable("pageAction", 930 EXPECT_FALSE(extension_api->IsAvailable("pageAction",
931 extension.get(), 931 extension.get(),
932 Feature::BLESSED_EXTENSION_CONTEXT, 932 Feature::BLESSED_EXTENSION_CONTEXT,
933 GURL()).is_available()); 933 GURL()).is_available());
934 } 934 }
935 935
936 } // namespace extensions 936 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698