OLD | NEW |
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 <memory> | 5 #include <memory> |
6 #include <string> | 6 #include <string> |
7 #include <utility> | 7 #include <utility> |
8 | 8 |
9 #include "base/compiler_specific.h" | 9 #include "base/compiler_specific.h" |
10 #include "base/macros.h" | 10 #include "base/macros.h" |
(...skipping 19 matching lines...) Expand all Loading... |
30 #include "extensions/common/extension.h" | 30 #include "extensions/common/extension.h" |
31 #include "extensions/common/extension_builder.h" | 31 #include "extensions/common/extension_builder.h" |
32 #include "extensions/common/features/feature.h" | 32 #include "extensions/common/features/feature.h" |
33 #include "extensions/common/features/feature_channel.h" | 33 #include "extensions/common/features/feature_channel.h" |
34 #include "extensions/common/permissions/permissions_data.h" | 34 #include "extensions/common/permissions/permissions_data.h" |
35 #include "extensions/common/value_builder.h" | 35 #include "extensions/common/value_builder.h" |
36 | 36 |
37 #if defined(OS_CHROMEOS) | 37 #if defined(OS_CHROMEOS) |
38 #include "base/run_loop.h" | 38 #include "base/run_loop.h" |
39 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 39 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
40 #include "chrome/browser/chromeos/login/users/scoped_test_user_manager.h" | |
41 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 40 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
42 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 41 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
43 #include "chrome/browser/chromeos/settings/device_settings_service.h" | |
44 #include "chrome/test/base/scoped_testing_local_state.h" | 42 #include "chrome/test/base/scoped_testing_local_state.h" |
45 #include "chrome/test/base/testing_browser_process.h" | 43 #include "chrome/test/base/testing_browser_process.h" |
46 #include "chromeos/login/scoped_test_public_session_login_state.h" | 44 #include "chromeos/login/scoped_test_public_session_login_state.h" |
47 #include "components/signin/core/account_id/account_id.h" | 45 #include "components/signin/core/account_id/account_id.h" |
48 #include "extensions/browser/extension_dialog_auto_confirm.h" | 46 #include "extensions/browser/extension_dialog_auto_confirm.h" |
49 #endif | 47 #endif |
50 | 48 |
51 using base::DictionaryValue; | 49 using base::DictionaryValue; |
52 using base::ListValue; | 50 using base::ListValue; |
53 using content::BrowserThread; | 51 using content::BrowserThread; |
(...skipping 390 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
444 // Test that the platform delegate is being set and the permission is prompted | 442 // Test that the platform delegate is being set and the permission is prompted |
445 // for. | 443 // for. |
446 TEST_F(ActiveTabTest, DelegateIsSet) { | 444 TEST_F(ActiveTabTest, DelegateIsSet) { |
447 // Setup, login a public account user. | 445 // Setup, login a public account user. |
448 chromeos::ScopedTestPublicSessionLoginState login_state; | 446 chromeos::ScopedTestPublicSessionLoginState login_state; |
449 std::string user_id = "public@account.user"; | 447 std::string user_id = "public@account.user"; |
450 std::string user_email = user_id; | 448 std::string user_email = user_id; |
451 AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, user_id); | 449 AccountId account_id = AccountId::FromUserEmailGaiaId(user_email, user_id); |
452 std::string user_id_hash = chromeos::ProfileHelper::Get()-> | 450 std::string user_id_hash = chromeos::ProfileHelper::Get()-> |
453 GetUserIdHashByUserIdForTesting(user_id); | 451 GetUserIdHashByUserIdForTesting(user_id); |
454 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | |
455 chromeos::ScopedTestCrosSettings test_cros_settings_; | |
456 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); | 452 ScopedTestingLocalState local_state(TestingBrowserProcess::GetGlobal()); |
457 chromeos::ScopedTestUserManager test_user_manager_; | |
458 chromeos::WallpaperManager::Initialize(); | 453 chromeos::WallpaperManager::Initialize(); |
459 g_browser_process->local_state()->SetString( | 454 g_browser_process->local_state()->SetString( |
460 "PublicAccountPendingDataRemoval", user_email); | 455 "PublicAccountPendingDataRemoval", user_email); |
461 user_manager::UserManager::Get()->UserLoggedIn( | 456 user_manager::UserManager::Get()->UserLoggedIn( |
462 account_id, user_id_hash, true); | 457 account_id, user_id_hash, true); |
463 | 458 |
464 GURL google("http://www.google.com"); | 459 GURL google("http://www.google.com"); |
465 NavigateAndCommit(google); | 460 NavigateAndCommit(google); |
466 | 461 |
467 // Grant and verify. | 462 // Grant and verify. |
(...skipping 16 matching lines...) Expand all Loading... |
484 base::RunLoop().RunUntilIdle(); | 479 base::RunLoop().RunUntilIdle(); |
485 EXPECT_TRUE(IsBlocked(another_extension, google)); | 480 EXPECT_TRUE(IsBlocked(another_extension, google)); |
486 active_tab_permission_granter()->GrantIfRequested(another_extension.get()); | 481 active_tab_permission_granter()->GrantIfRequested(another_extension.get()); |
487 base::RunLoop().RunUntilIdle(); | 482 base::RunLoop().RunUntilIdle(); |
488 EXPECT_TRUE(IsBlocked(another_extension, google)); | 483 EXPECT_TRUE(IsBlocked(another_extension, google)); |
489 } | 484 } |
490 | 485 |
491 // Cleanup. | 486 // Cleanup. |
492 chromeos::WallpaperManager::Shutdown(); | 487 chromeos::WallpaperManager::Shutdown(); |
493 delete ActiveTabPermissionGranter::SetPlatformDelegate(nullptr); | 488 delete ActiveTabPermissionGranter::SetPlatformDelegate(nullptr); |
| 489 chromeos::ChromeUserManager::Get()->Shutdown(); |
494 } | 490 } |
495 #endif // defined(OS_CHROMEOS) | 491 #endif // defined(OS_CHROMEOS) |
496 | 492 |
497 } // namespace | 493 } // namespace |
498 } // namespace extensions | 494 } // namespace extensions |
OLD | NEW |