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

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

Issue 2255613003: Introduce session type parameter to extension features (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Introduce session type parameter to extension features Created 4 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
« no previous file with comments | « no previous file | chrome/test/data/extensions/extension_api_unittest/api_features.json » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 184 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
185 {"parent3", true, Feature::CONTENT_SCRIPT_CONTEXT, 185 {"parent3", true, Feature::CONTENT_SCRIPT_CONTEXT,
186 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 186 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
187 {"parent3", false, Feature::BLESSED_EXTENSION_CONTEXT, 187 {"parent3", false, Feature::BLESSED_EXTENSION_CONTEXT,
188 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 188 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
189 {"parent3", false, Feature::UNBLESSED_EXTENSION_CONTEXT, 189 {"parent3", false, Feature::UNBLESSED_EXTENSION_CONTEXT,
190 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 190 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
191 {"parent3.noparent", true, Feature::CONTENT_SCRIPT_CONTEXT, 191 {"parent3.noparent", true, Feature::CONTENT_SCRIPT_CONTEXT,
192 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 192 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
193 {"parent3.noparent", true, Feature::BLESSED_EXTENSION_CONTEXT, 193 {"parent3.noparent", true, Feature::BLESSED_EXTENSION_CONTEXT,
194 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 194 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
Devlin 2016/08/17 16:51:07 Does this CL need to be rebased? This seems diffe
195 {"parent3.noparent", true, Feature::UNBLESSED_EXTENSION_CONTEXT, 195 {"parent3.noparent", true, Feature::UNBLESSED_EXTENSION_CONTEXT,
196 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 196 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
197 {"parent3.noparent.child", true, Feature::CONTENT_SCRIPT_CONTEXT, 197 {"parent3.noparent.child", true, Feature::CONTENT_SCRIPT_CONTEXT,
198 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 198 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
199 {"parent3.noparent.child", true, Feature::BLESSED_EXTENSION_CONTEXT, 199 {"parent3.noparent.child", true, Feature::BLESSED_EXTENSION_CONTEXT,
200 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 200 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
201 {"parent3.noparent.child", true, Feature::UNBLESSED_EXTENSION_CONTEXT, 201 {"parent3.noparent.child", true, Feature::UNBLESSED_EXTENSION_CONTEXT,
202 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}, 202 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
203 }; 203
204 // Session types.
205 {"kiosk_only", true, Feature::BLESSED_EXTENSION_CONTEXT,
206 Feature::SESSION_TYPE_KIOSK, GURL()},
207 {"kiosk_only", false, Feature::BLESSED_EXTENSION_CONTEXT,
208 Feature::SESSION_TYPE_REGULAR, GURL()},
209 {"kiosk_only", false, Feature::BLESSED_EXTENSION_CONTEXT,
210 Feature::SESSION_TYPE_UNSPECIFIED, GURL()},
211 {"non_kiosk", false, Feature::BLESSED_EXTENSION_CONTEXT,
212 Feature::SESSION_TYPE_KIOSK, GURL()},
213 {"non_kiosk", true, Feature::BLESSED_EXTENSION_CONTEXT,
214 Feature::SESSION_TYPE_REGULAR, GURL()},
215 {"non_kiosk", false, Feature::BLESSED_EXTENSION_CONTEXT,
216 Feature::SESSION_TYPE_UNSPECIFIED, GURL()}};
204 217
205 base::FilePath api_features_path; 218 base::FilePath api_features_path;
206 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path); 219 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path);
207 api_features_path = api_features_path.AppendASCII("extensions") 220 api_features_path = api_features_path.AppendASCII("extensions")
208 .AppendASCII("extension_api_unittest") 221 .AppendASCII("extension_api_unittest")
209 .AppendASCII("api_features.json"); 222 .AppendASCII("api_features.json");
210 223
211 std::string api_features_str; 224 std::string api_features_str;
212 ASSERT_TRUE(base::ReadFileToString( 225 ASSERT_TRUE(base::ReadFileToString(
213 api_features_path, &api_features_str)) << "api_features.json"; 226 api_features_path, &api_features_str)) << "api_features.json";
(...skipping 80 matching lines...) Expand 10 before | Expand all | Expand 10 after
294 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL()}, 307 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL()},
295 {"test3", true, Feature::WEB_PAGE_CONTEXT, 308 {"test3", true, Feature::WEB_PAGE_CONTEXT,
296 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://foo.com")}, 309 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://foo.com")},
297 {"test4.foo", true, Feature::CONTENT_SCRIPT_CONTEXT, 310 {"test4.foo", true, Feature::CONTENT_SCRIPT_CONTEXT,
298 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL()}, 311 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL()},
299 {"test7", false, Feature::WEB_PAGE_CONTEXT, 312 {"test7", false, Feature::WEB_PAGE_CONTEXT,
300 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://google.com")}, 313 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://google.com")},
301 {"test7", true, Feature::WEB_PAGE_CONTEXT, 314 {"test7", true, Feature::WEB_PAGE_CONTEXT,
302 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://foo.com")}, 315 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://foo.com")},
303 {"test7", false, Feature::WEB_PAGE_CONTEXT, 316 {"test7", false, Feature::WEB_PAGE_CONTEXT,
304 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://bar.com")}}; 317 Feature::SESSION_TYPE_UNSPECIFIED, NULL, GURL("http://bar.com")},
318 {"kiosk_only", true, Feature::BLESSED_EXTENSION_CONTEXT,
319 Feature::SESSION_TYPE_KIOSK, extension.get(), GURL()},
320 {"kiosk_only", false, Feature::BLESSED_EXTENSION_CONTEXT,
321 Feature::SESSION_TYPE_REGULAR, extension.get(), GURL()},
322 {"non_kiosk", false, Feature::BLESSED_EXTENSION_CONTEXT,
323 Feature::SESSION_TYPE_KIOSK, extension.get(), GURL()},
324 {"non_kiosk", true, Feature::BLESSED_EXTENSION_CONTEXT,
325 Feature::SESSION_TYPE_REGULAR, extension.get(), GURL()},
326
327 };
305 328
306 base::FilePath api_features_path; 329 base::FilePath api_features_path;
307 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path); 330 PathService::Get(chrome::DIR_TEST_DATA, &api_features_path);
308 api_features_path = api_features_path.AppendASCII("extensions") 331 api_features_path = api_features_path.AppendASCII("extensions")
309 .AppendASCII("extension_api_unittest") 332 .AppendASCII("extension_api_unittest")
310 .AppendASCII("api_features.json"); 333 .AppendASCII("api_features.json");
311 334
312 std::string api_features_str; 335 std::string api_features_str;
313 ASSERT_TRUE(base::ReadFileToString( 336 ASSERT_TRUE(base::ReadFileToString(
314 api_features_path, &api_features_str)) << "api_features.json"; 337 api_features_path, &api_features_str)) << "api_features.json";
(...skipping 570 matching lines...) Expand 10 before | Expand all | Expand 10 after
885 Feature::SESSION_TYPE_UNSPECIFIED, GURL()) 908 Feature::SESSION_TYPE_UNSPECIFIED, GURL())
886 .is_available()); 909 .is_available());
887 EXPECT_FALSE(extension_api 910 EXPECT_FALSE(extension_api
888 ->IsAvailable("pageAction", extension.get(), 911 ->IsAvailable("pageAction", extension.get(),
889 Feature::BLESSED_EXTENSION_CONTEXT, 912 Feature::BLESSED_EXTENSION_CONTEXT,
890 Feature::SESSION_TYPE_UNSPECIFIED, GURL()) 913 Feature::SESSION_TYPE_UNSPECIFIED, GURL())
891 .is_available()); 914 .is_available());
892 } 915 }
893 916
894 } // namespace extensions 917 } // namespace extensions
OLDNEW
« no previous file with comments | « no previous file | chrome/test/data/extensions/extension_api_unittest/api_features.json » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698