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

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

Issue 1865133002: kiosk: Fix kiosk session restart (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, fix nits Created 4 years, 8 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 | « chrome/browser/chromeos/login/users/mock_user_manager.h ('k') | chrome/chrome_tests.gypi » ('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 "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
11 #include "base/files/file_path.h" 11 #include "base/files/file_path.h"
12 #include "base/macros.h" 12 #include "base/macros.h"
13 #include "base/run_loop.h" 13 #include "base/run_loop.h"
14 #include "base/strings/string_split.h" 14 #include "base/strings/string_split.h"
15 #include "base/strings/string_util.h" 15 #include "base/strings/string_util.h"
16 #include "base/strings/utf_string_conversions.h" 16 #include "base/strings/utf_string_conversions.h"
17 #include "build/build_config.h" 17 #include "build/build_config.h"
18 #include "testing/gtest/include/gtest/gtest.h" 18 #include "testing/gtest/include/gtest/gtest.h"
19 #include "ui/shell_dialogs/select_file_dialog.h" 19 #include "ui/shell_dialogs/select_file_dialog.h"
20 20
21 #if defined(OS_CHROMEOS) 21 #if defined(OS_CHROMEOS)
22 #include "base/memory/ref_counted.h" 22 #include "base/memory/ref_counted.h"
23 #include "base/memory/weak_ptr.h" 23 #include "base/memory/weak_ptr.h"
24 #include "chrome/browser/chromeos/file_manager/volume_manager.h" 24 #include "chrome/browser/chromeos/file_manager/volume_manager.h"
25 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" 25 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h"
26 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 26 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
27 #include "chrome/test/base/testing_browser_process.h" 27 #include "chrome/test/base/testing_browser_process.h"
28 #include "components/prefs/testing_pref_service.h" 28 #include "components/prefs/testing_pref_service.h"
29 #include "components/user_manager/user.h"
29 #include "content/public/test/test_browser_thread_bundle.h" 30 #include "content/public/test/test_browser_thread_bundle.h"
30 #include "extensions/common/extension.h" 31 #include "extensions/common/extension.h"
31 #include "extensions/common/extension_builder.h" 32 #include "extensions/common/extension_builder.h"
32 #include "extensions/common/manifest.h" 33 #include "extensions/common/manifest.h"
33 #include "extensions/common/test_util.h" 34 #include "extensions/common/test_util.h"
34 #include "extensions/common/value_builder.h" 35 #include "extensions/common/value_builder.h"
35 #endif 36 #endif
36 37
37 using extensions::FileSystemChooseEntryFunction; 38 using extensions::FileSystemChooseEntryFunction;
38 using extensions::api::file_system::AcceptOption; 39 using extensions::api::file_system::AcceptOption;
(...skipping 353 matching lines...) Expand 10 before | Expand all | Expand 10 after
392 393
393 // Non-component apps in manual-launch kiosk mode will be granted access after 394 // Non-component apps in manual-launch kiosk mode will be granted access after
394 // receiving approval from the user. 395 // receiving approval from the user.
395 scoped_refptr<Extension> manual_launch_kiosk_app( 396 scoped_refptr<Extension> manual_launch_kiosk_app(
396 test_util::BuildApp(ExtensionBuilder()) 397 test_util::BuildApp(ExtensionBuilder())
397 .MergeManifest(DictionaryBuilder() 398 .MergeManifest(DictionaryBuilder()
398 .SetBoolean("kiosk_enabled", true) 399 .SetBoolean("kiosk_enabled", true)
399 .SetBoolean("kiosk_only", true) 400 .SetBoolean("kiosk_only", true)
400 .Build()) 401 .Build())
401 .Build()); 402 .Build());
402 user_manager_->KioskAppLoggedIn( 403 user_manager::User* const manual_kiosk_app_user =
403 AccountId::FromUserEmail(manual_launch_kiosk_app->id())); 404 user_manager_->AddKioskAppUser(
405 AccountId::FromUserEmail(manual_launch_kiosk_app->id()));
406 user_manager_->KioskAppLoggedIn(manual_kiosk_app_user);
404 { 407 {
405 TestingConsentProviderDelegate delegate; 408 TestingConsentProviderDelegate delegate;
406 delegate.SetDialogButton(ui::DIALOG_BUTTON_OK); 409 delegate.SetDialogButton(ui::DIALOG_BUTTON_OK);
407 ConsentProvider provider(&delegate); 410 ConsentProvider provider(&delegate);
408 EXPECT_TRUE(provider.IsGrantable(*manual_launch_kiosk_app)); 411 EXPECT_TRUE(provider.IsGrantable(*manual_launch_kiosk_app));
409 412
410 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE; 413 ConsentProvider::Consent result = ConsentProvider::CONSENT_IMPOSSIBLE;
411 provider.RequestConsent(*manual_launch_kiosk_app.get(), volume_, 414 provider.RequestConsent(*manual_launch_kiosk_app.get(), volume_,
412 true /* writable */, 415 true /* writable */,
413 base::Bind(&OnConsentReceived, &result)); 416 base::Bind(&OnConsentReceived, &result));
(...skipping 19 matching lines...) Expand all
433 base::RunLoop().RunUntilIdle(); 436 base::RunLoop().RunUntilIdle();
434 437
435 EXPECT_EQ(1, delegate.show_dialog_counter()); 438 EXPECT_EQ(1, delegate.show_dialog_counter());
436 EXPECT_EQ(0, delegate.show_notification_counter()); 439 EXPECT_EQ(0, delegate.show_notification_counter());
437 EXPECT_EQ(ConsentProvider::CONSENT_REJECTED, result); 440 EXPECT_EQ(ConsentProvider::CONSENT_REJECTED, result);
438 } 441 }
439 } 442 }
440 #endif 443 #endif
441 444
442 } // namespace extensions 445 } // namespace extensions
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/login/users/mock_user_manager.h ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698