| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" | 5 #include "chrome/browser/chromeos/extensions/device_local_account_management_pol
icy_provider.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 #include <utility> | 8 #include <utility> |
| 9 | 9 |
| 10 #include "base/files/file_path.h" | 10 #include "base/files/file_path.h" |
| (...skipping 303 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 314 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 314 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
| 315 EXPECT_NE(base::string16(), error); | 315 EXPECT_NE(base::string16(), error); |
| 316 error.clear(); | 316 error.clear(); |
| 317 } | 317 } |
| 318 | 318 |
| 319 // Verify that a platform app with an unsafe permission entry cannot be | 319 // Verify that a platform app with an unsafe permission entry cannot be |
| 320 // installed. Since the program logic is based entirely on whitelists, there | 320 // installed. Since the program logic is based entirely on whitelists, there |
| 321 // is no significant advantage in testing all unsafe permissions individually. | 321 // is no significant advantage in testing all unsafe permissions individually. |
| 322 { | 322 { |
| 323 base::ListValue* const permissions = new base::ListValue(); | 323 base::ListValue* const permissions = new base::ListValue(); |
| 324 permissions->AppendString("audioCapture"); | 324 permissions->AppendString("experimental"); |
| 325 base::DictionaryValue values; | 325 base::DictionaryValue values; |
| 326 values.Set(extensions::manifest_keys::kPermissions, permissions); | 326 values.Set(extensions::manifest_keys::kPermissions, permissions); |
| 327 | 327 |
| 328 extension = CreatePlatformAppWithExtraValues( | 328 extension = CreatePlatformAppWithExtraValues( |
| 329 &values, | 329 &values, |
| 330 extensions::Manifest::EXTERNAL_POLICY, | 330 extensions::Manifest::EXTERNAL_POLICY, |
| 331 extensions::Extension::NO_FLAGS); | 331 extensions::Extension::NO_FLAGS); |
| 332 ASSERT_TRUE(extension); | 332 ASSERT_TRUE(extension); |
| 333 | 333 |
| 334 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 334 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
| 335 EXPECT_NE(base::string16(), error); | 335 EXPECT_NE(base::string16(), error); |
| 336 error.clear(); | 336 error.clear(); |
| 337 } | 337 } |
| 338 | 338 |
| 339 // Verify that a platform app with an unsafe optional permission entry cannot | 339 // Verify that a platform app with an unsafe optional permission entry cannot |
| 340 // be installed. | 340 // be installed. |
| 341 { | 341 { |
| 342 base::ListValue* const permissions = new base::ListValue(); | 342 base::ListValue* const permissions = new base::ListValue(); |
| 343 permissions->AppendString("audioCapture"); | 343 permissions->AppendString("experimental"); |
| 344 base::DictionaryValue values; | 344 base::DictionaryValue values; |
| 345 values.Set(extensions::manifest_keys::kOptionalPermissions, permissions); | 345 values.Set(extensions::manifest_keys::kOptionalPermissions, permissions); |
| 346 | 346 |
| 347 extension = CreatePlatformAppWithExtraValues( | 347 extension = CreatePlatformAppWithExtraValues( |
| 348 &values, | 348 &values, |
| 349 extensions::Manifest::EXTERNAL_POLICY, | 349 extensions::Manifest::EXTERNAL_POLICY, |
| 350 extensions::Extension::NO_FLAGS); | 350 extensions::Extension::NO_FLAGS); |
| 351 ASSERT_TRUE(extension); | 351 ASSERT_TRUE(extension); |
| 352 | 352 |
| 353 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); | 353 EXPECT_FALSE(provider.UserMayLoad(extension.get(), &error)); |
| (...skipping 245 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 599 // types of device-local accounts cannot be installed in a single-app kiosk | 599 // types of device-local accounts cannot be installed in a single-app kiosk |
| 600 // session. | 600 // session. |
| 601 extension = CreateRegularExtension(kWhitelistedId); | 601 extension = CreateRegularExtension(kWhitelistedId); |
| 602 ASSERT_TRUE(extension.get()); | 602 ASSERT_TRUE(extension.get()); |
| 603 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); | 603 EXPECT_TRUE(provider.UserMayLoad(extension.get(), &error)); |
| 604 EXPECT_EQ(base::string16(), error); | 604 EXPECT_EQ(base::string16(), error); |
| 605 error.clear(); | 605 error.clear(); |
| 606 } | 606 } |
| 607 | 607 |
| 608 } // namespace chromeos | 608 } // namespace chromeos |
| OLD | NEW |