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