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

Side by Side Diff: chrome/browser/extensions/api/file_system/file_system_api_unittest.cc

Issue 1739183003: Make extensions::DictionaryBuilder and extensions::ListValue unmovable. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 10 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
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/browser/extensions/api/file_system/file_system_api.h" 5 #include "chrome/browser/extensions/api/file_system/file_system_api.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <vector> 9 #include <vector>
10 10
(...skipping 352 matching lines...) Expand 10 before | Expand all | Expand 10 after
363 } 363 }
364 364
365 TEST_F(FileSystemApiConsentProviderTest, ForKioskApps) { 365 TEST_F(FileSystemApiConsentProviderTest, ForKioskApps) {
366 // Non-component apps in auto-launch kiosk mode will be granted access 366 // Non-component apps in auto-launch kiosk mode will be granted access
367 // instantly without asking for user consent, but with a notification. 367 // instantly without asking for user consent, but with a notification.
368 { 368 {
369 scoped_refptr<Extension> auto_launch_kiosk_app( 369 scoped_refptr<Extension> auto_launch_kiosk_app(
370 test_util::BuildApp(ExtensionBuilder()) 370 test_util::BuildApp(ExtensionBuilder())
371 .MergeManifest(DictionaryBuilder() 371 .MergeManifest(DictionaryBuilder()
372 .SetBoolean("kiosk_enabled", true) 372 .SetBoolean("kiosk_enabled", true)
373 .SetBoolean("kiosk_only", true)) 373 .SetBoolean("kiosk_only", true)
374 .Build())
374 .Build()); 375 .Build());
375 user_manager_->AddKioskAppUser( 376 user_manager_->AddKioskAppUser(
376 AccountId::FromUserEmail(auto_launch_kiosk_app->id())); 377 AccountId::FromUserEmail(auto_launch_kiosk_app->id()));
377 user_manager_->LoginUser( 378 user_manager_->LoginUser(
378 AccountId::FromUserEmail(auto_launch_kiosk_app->id())); 379 AccountId::FromUserEmail(auto_launch_kiosk_app->id()));
379 380
380 TestingConsentProviderDelegate delegate; 381 TestingConsentProviderDelegate delegate;
381 delegate.SetIsAutoLaunched(true); 382 delegate.SetIsAutoLaunched(true);
382 ConsentProvider provider(&delegate); 383 ConsentProvider provider(&delegate);
383 EXPECT_TRUE(provider.IsGrantable(*auto_launch_kiosk_app)); 384 EXPECT_TRUE(provider.IsGrantable(*auto_launch_kiosk_app));
384 385
385 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE; 386 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE;
386 provider.RequestConsent(*auto_launch_kiosk_app.get(), volume_, 387 provider.RequestConsent(*auto_launch_kiosk_app.get(), volume_,
387 true /* writable */, 388 true /* writable */,
388 base::Bind(&OnConsentReceived, &result)); 389 base::Bind(&OnConsentReceived, &result));
389 base::RunLoop().RunUntilIdle(); 390 base::RunLoop().RunUntilIdle();
390 391
391 EXPECT_EQ(0, delegate.show_dialog_counter()); 392 EXPECT_EQ(0, delegate.show_dialog_counter());
392 EXPECT_EQ(1, delegate.show_notification_counter()); 393 EXPECT_EQ(1, delegate.show_notification_counter());
393 EXPECT_EQ(ConsentProvider::CONSENT_GRANTED, result); 394 EXPECT_EQ(ConsentProvider::CONSENT_GRANTED, result);
394 } 395 }
395 396
396 // Non-component apps in manual-launch kiosk mode will be granted access after 397 // Non-component apps in manual-launch kiosk mode will be granted access after
397 // receiving approval from the user. 398 // receiving approval from the user.
398 scoped_refptr<Extension> manual_launch_kiosk_app( 399 scoped_refptr<Extension> manual_launch_kiosk_app(
399 test_util::BuildApp(ExtensionBuilder()) 400 test_util::BuildApp(ExtensionBuilder())
400 .MergeManifest(DictionaryBuilder() 401 .MergeManifest(DictionaryBuilder()
401 .SetBoolean("kiosk_enabled", true) 402 .SetBoolean("kiosk_enabled", true)
402 .SetBoolean("kiosk_only", true)) 403 .SetBoolean("kiosk_only", true)
404 .Build())
403 .Build()); 405 .Build());
404 user_manager_->KioskAppLoggedIn( 406 user_manager_->KioskAppLoggedIn(
405 AccountId::FromUserEmail(manual_launch_kiosk_app->id())); 407 AccountId::FromUserEmail(manual_launch_kiosk_app->id()));
406 { 408 {
407 TestingConsentProviderDelegate delegate; 409 TestingConsentProviderDelegate delegate;
408 delegate.SetDialogButton(ui::DIALOG_BUTTON_OK); 410 delegate.SetDialogButton(ui::DIALOG_BUTTON_OK);
409 ConsentProvider provider(&delegate); 411 ConsentProvider provider(&delegate);
410 EXPECT_TRUE(provider.IsGrantable(*manual_launch_kiosk_app)); 412 EXPECT_TRUE(provider.IsGrantable(*manual_launch_kiosk_app));
411 413
412 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE; 414 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE;
(...skipping 22 matching lines...) Expand all
435 base::RunLoop().RunUntilIdle(); 437 base::RunLoop().RunUntilIdle();
436 438
437 EXPECT_EQ(1, delegate.show_dialog_counter()); 439 EXPECT_EQ(1, delegate.show_dialog_counter());
438 EXPECT_EQ(0, delegate.show_notification_counter()); 440 EXPECT_EQ(0, delegate.show_notification_counter());
439 EXPECT_EQ(ConsentProvider::CONSENT_REJECTED, result); 441 EXPECT_EQ(ConsentProvider::CONSENT_REJECTED, result);
440 } 442 }
441 } 443 }
442 #endif 444 #endif
443 445
444 } // namespace extensions 446 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698