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

Unified Diff: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm

Issue 2920853004: [sync] Display an error when sync settings aren't confirmed (Closed)
Patch Set: Reformat, remove browser_options change Created 3 years, 6 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
diff --git a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
index c9398578e22722268be2426376114eb5edbbbf74..a680e6b2af25aee128b67c25feb765d969acaebf 100644
--- a/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
+++ b/chrome/browser/ui/cocoa/profiles/profile_chooser_controller_unittest.mm
@@ -24,6 +24,8 @@
#include "chrome/browser/signin/fake_profile_oauth2_token_service_builder.h"
#include "chrome/browser/signin/profile_oauth2_token_service_factory.h"
#include "chrome/browser/signin/signin_manager_factory.h"
+#include "chrome/browser/sync/profile_sync_service_factory.h"
+#include "chrome/browser/sync/profile_sync_test_util.h"
#include "chrome/browser/ui/browser.h"
#import "chrome/browser/ui/cocoa/info_bubble_view.h"
#include "chrome/browser/ui/cocoa/l10n_util.h"
@@ -39,6 +41,8 @@
#include "components/signin/core/common/signin_pref_names.h"
#include "components/sync_preferences/pref_service_syncable.h"
+using ::testing::Return;
+
const std::string kGaiaId = "gaiaid-user@gmail.com";
const std::string kEmail = "user@gmail.com";
const std::string kSecondaryEmail = "user2@gmail.com";
@@ -55,6 +59,8 @@ class ProfileChooserControllerTest : public CocoaProfileTest {
factories.push_back(
std::make_pair(AccountFetcherServiceFactory::GetInstance(),
FakeAccountFetcherServiceBuilder::BuildForTests));
+ factories.push_back(std::make_pair(ProfileSyncServiceFactory::GetInstance(),
+ BuildMockProfileSyncService));
AddTestingFactories(factories);
}
@@ -74,6 +80,10 @@ class ProfileChooserControllerTest : public CocoaProfileTest {
base::ASCIIToUTF16("Test 2"), 1, std::string(),
TestingProfile::TestingFactories());
+ mock_sync_service_ = static_cast<browser_sync::ProfileSyncServiceMock*>(
+ ProfileSyncServiceFactory::GetInstance()->GetForProfile(
+ browser()->profile()));
+
menu_ = new AvatarMenu(
testing_profile_manager()->profile_attributes_storage(), NULL, NULL);
menu_->RebuildMenu();
@@ -109,11 +119,21 @@ class ProfileChooserControllerTest : public CocoaProfileTest {
entry->SetAuthInfo(kGaiaId, base::ASCIIToUTF16(kEmail));
}
+ void SuppressSyncConfirmationError() {
+ EXPECT_CALL(*mock_sync_service_, IsFirstSetupComplete())
+ .WillRepeatedly(Return(false));
+ EXPECT_CALL(*mock_sync_service_, IsFirstSetupInProgress())
+ .WillRepeatedly(Return(true));
+ EXPECT_CALL(*mock_sync_service_, IsSyncConfirmationNeeded())
+ .WillRepeatedly(Return(false));
+ }
+
ProfileChooserController* controller() { return controller_; }
AvatarMenu* menu() { return menu_; }
private:
base::scoped_nsobject<ProfileChooserController> controller_;
+ browser_sync::ProfileSyncServiceMock* mock_sync_service_ = nullptr;
// Weak; owned by |controller_|.
AvatarMenu* menu_;
@@ -290,6 +310,8 @@ TEST_F(ProfileChooserControllerTest, AccountManagementLayout) {
ProfileOAuth2TokenServiceFactory::GetForProfile(profile)
->UpdateCredentials(account_id, kLoginToken);
+ SuppressSyncConfirmationError();
+
StartProfileChooserController();
[controller() initMenuContentsWithView:
profiles::BUBBLE_VIEW_MODE_ACCOUNT_MANAGEMENT];

Powered by Google App Engine
This is Rietveld 408576698