| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
| 11 #include "base/files/file_path.h" | 11 #include "base/files/file_path.h" |
| 12 #include "base/files/file_util.h" | 12 #include "base/files/file_util.h" |
| 13 #include "base/files/scoped_temp_dir.h" | 13 #include "base/files/scoped_temp_dir.h" |
| 14 #include "base/macros.h" | 14 #include "base/macros.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" | 16 #include "chrome/browser/chromeos/arc/arc_auth_service.h" |
| 17 #include "chrome/browser/chromeos/arc/arc_optin_uma.h" |
| 17 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" | 18 #include "chrome/browser/chromeos/login/users/fake_chrome_user_manager.h" |
| 18 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" | 19 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" |
| 19 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" | 20 #include "chrome/browser/chromeos/login/users/wallpaper/wallpaper_manager.h" |
| 20 #include "chrome/browser/chromeos/profiles/profile_helper.h" | 21 #include "chrome/browser/chromeos/profiles/profile_helper.h" |
| 21 #include "chrome/browser/prefs/pref_service_syncable_util.h" | 22 #include "chrome/browser/prefs/pref_service_syncable_util.h" |
| 22 #include "chrome/browser/profiles/profile.h" | 23 #include "chrome/browser/profiles/profile.h" |
| 23 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" | 24 #include "chrome/browser/ui/app_list/arc/arc_app_list_prefs.h" |
| 24 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" | 25 #include "chrome/browser/ui/ash/multi_user/multi_user_util.h" |
| 25 #include "chrome/common/pref_names.h" | 26 #include "chrome/common/pref_names.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 27 #include "chrome/test/base/testing_profile.h" |
| (...skipping 403 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 430 WaitForDataRemoved(ArcAuthService::State::SHOWING_TERMS_OF_SERVICE)); | 431 WaitForDataRemoved(ArcAuthService::State::SHOWING_TERMS_OF_SERVICE)); |
| 431 | 432 |
| 432 EXPECT_FALSE( | 433 EXPECT_FALSE( |
| 433 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); | 434 profile()->GetPrefs()->GetBoolean(prefs::kArcDataRemoveRequested)); |
| 434 | 435 |
| 435 auth_service()->StartArc(); | 436 auth_service()->StartArc(); |
| 436 EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state()); | 437 EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state()); |
| 437 auth_service()->Shutdown(); | 438 auth_service()->Shutdown(); |
| 438 } | 439 } |
| 439 | 440 |
| 441 TEST_F(ArcAuthServiceTest, IgnoreSecondErrorReporting) { |
| 442 profile()->GetPrefs()->SetBoolean(prefs::kArcEnabled, true); |
| 443 auth_service()->OnPrimaryUserProfilePrepared(profile()); |
| 444 auth_service()->StartArc(); |
| 445 EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state()); |
| 446 |
| 447 // Report some failure that does not stop the bridge. |
| 448 auth_service()->OnProvisioningFinished( |
| 449 ProvisioningResult::GMS_SIGN_IN_FAILED); |
| 450 EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state()); |
| 451 |
| 452 // Try to send another error that stops the bridge if sent first. It should |
| 453 // be ignored. |
| 454 auth_service()->OnProvisioningFinished( |
| 455 ProvisioningResult::CHROME_SERVER_COMMUNICATION_ERROR); |
| 456 EXPECT_EQ(ArcAuthService::State::ACTIVE, auth_service()->state()); |
| 457 |
| 458 auth_service()->Shutdown(); |
| 459 } |
| 460 |
| 440 } // namespace arc | 461 } // namespace arc |
| OLD | NEW |