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

Unified Diff: extensions/renderer/bindings/api_binding_unittest.cc

Issue 2950353004: [Extensions Bindings] Check availability of custom API properties (Closed)
Patch Set: jbroman's Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « extensions/renderer/bindings/api_binding.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: extensions/renderer/bindings/api_binding_unittest.cc
diff --git a/extensions/renderer/bindings/api_binding_unittest.cc b/extensions/renderer/bindings/api_binding_unittest.cc
index 9f43d1aa5b47efda7a9c325969b8ecebefdc6cb6..73e1ab3d84ed74d0e83b90fbac2068531be5b8cb 100644
--- a/extensions/renderer/bindings/api_binding_unittest.cc
+++ b/extensions/renderer/bindings/api_binding_unittest.cc
@@ -606,6 +606,16 @@ TEST_F(APIBindingUnittest, TestProperties) {
" 'subprop1': { 'value': 'some value', 'type': 'string' },"
" 'subprop2': { 'value': true, 'type': 'boolean' }"
" }"
+ " },"
+ " 'linuxOnly': {"
+ " 'value': 'linux',"
+ " 'type': 'string',"
+ " 'platforms': ['linux']"
+ " },"
+ " 'nonLinuxOnly': {"
+ " 'value': 'nonlinux',"
+ " 'type': 'string',"
+ " 'platforms': ['win', 'mac', 'chromeos']"
" }"
"}");
InitializeBinding();
@@ -617,6 +627,18 @@ TEST_F(APIBindingUnittest, TestProperties) {
GetStringPropertyFromObject(binding_object, context, "prop1"));
EXPECT_EQ(R"({"subprop1":"some value","subprop2":true})",
GetStringPropertyFromObject(binding_object, context, "prop2"));
+
+#if defined(OS_LINUX) && !defined(OS_CHROMEOS)
+ EXPECT_EQ("\"linux\"",
+ GetStringPropertyFromObject(binding_object, context, "linuxOnly"));
+ EXPECT_EQ("undefined", GetStringPropertyFromObject(binding_object, context,
+ "nonLinuxOnly"));
+#else
+ EXPECT_EQ("undefined",
+ GetStringPropertyFromObject(binding_object, context, "linuxOnly"));
+ EXPECT_EQ("\"nonlinux\"", GetStringPropertyFromObject(binding_object, context,
+ "nonLinuxOnly"));
+#endif
}
TEST_F(APIBindingUnittest, TestRefProperties) {
« no previous file with comments | « extensions/renderer/bindings/api_binding.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698