Index: chrome/browser/ui/webui/settings/sync_handler_unittest.cc |
diff --git a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/settings/sync_handler_unittest.cc |
similarity index 93% |
copy from chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc |
copy to chrome/browser/ui/webui/settings/sync_handler_unittest.cc |
index 233d473d59d94097c5ca65ddb479caca04d0d7cd..8638d32d6e76e20578ae2c9243196166464b0f8a 100644 |
--- a/chrome/browser/ui/webui/options/sync_setup_handler_unittest.cc |
+++ b/chrome/browser/ui/webui/settings/sync_handler_unittest.cc |
@@ -1,8 +1,8 @@ |
-// Copyright (c) 2012 The Chromium Authors. All rights reserved. |
+// Copyright 2015 The Chromium Authors. All rights reserved. |
// Use of this source code is governed by a BSD-style license that can be |
// found in the LICENSE file. |
-#include "chrome/browser/ui/webui/options/sync_setup_handler.h" |
+#include "chrome/browser/ui/webui/settings/sync_handler.h" |
#include <vector> |
@@ -144,22 +144,23 @@ void CheckConfigDataTypeArguments(const base::DictionaryValue* dictionary, |
types.Has(syncer::WIFI_CREDENTIALS)); |
} |
- |
} // namespace |
-class TestingSyncSetupHandler : public SyncSetupHandler { |
+namespace settings { |
+ |
+class TestingSyncHandler : public SyncHandler { |
public: |
- TestingSyncSetupHandler(content::WebUI* web_ui, Profile* profile) |
+ TestingSyncHandler(content::WebUI* web_ui, Profile* profile) |
: profile_(profile) { |
set_web_ui(web_ui); |
} |
- ~TestingSyncSetupHandler() override { set_web_ui(NULL); } |
+ ~TestingSyncHandler() override { set_web_ui(nullptr); } |
void FocusUI() override {} |
Profile* GetProfile() const override { return profile_; } |
- using SyncSetupHandler::is_configuring_sync; |
+ using SyncHandler::is_configuring_sync; |
private: |
#if !defined(OS_CHROMEOS) |
@@ -168,15 +169,15 @@ class TestingSyncSetupHandler : public SyncSetupHandler { |
// Weak pointer to parent profile. |
Profile* profile_; |
- DISALLOW_COPY_AND_ASSIGN(TestingSyncSetupHandler); |
+ DISALLOW_COPY_AND_ASSIGN(TestingSyncHandler); |
}; |
// The boolean parameter indicates whether the test is run with ClientOAuth |
// or not. The test parameter is a bool: whether or not to test with/ |
// /ClientLogin enabled or not. |
-class SyncSetupHandlerTest : public testing::Test { |
+class SyncHandlerTest : public testing::Test { |
public: |
- SyncSetupHandlerTest() : error_(GoogleServiceAuthError::NONE) {} |
+ SyncHandlerTest() : error_(GoogleServiceAuthError::NONE) {} |
void SetUp() override { |
error_ = GoogleServiceAuthError::AuthErrorNone(); |
@@ -208,7 +209,7 @@ class SyncSetupHandlerTest : public testing::Test { |
mock_pss_->Initialize(); |
- handler_.reset(new TestingSyncSetupHandler(&web_ui_, profile_.get())); |
+ handler_.reset(new TestingSyncHandler(&web_ui_, profile_.get())); |
} |
// Setup the expectations for calls made when displaying the config page. |
@@ -286,18 +287,18 @@ class SyncSetupHandlerTest : public testing::Test { |
GoogleServiceAuthError error_; |
SigninManagerBase* mock_signin_; |
content::TestWebUI web_ui_; |
- scoped_ptr<TestingSyncSetupHandler> handler_; |
+ scoped_ptr<TestingSyncHandler> handler_; |
}; |
-class SyncSetupHandlerFirstSigninTest : public SyncSetupHandlerTest { |
+class SyncHandlerFirstSigninTest : public SyncHandlerTest { |
std::string GetTestUser() override { return std::string(); } |
}; |
-TEST_F(SyncSetupHandlerTest, Basic) { |
+TEST_F(SyncHandlerTest, Basic) { |
} |
#if !defined(OS_CHROMEOS) |
-TEST_F(SyncSetupHandlerFirstSigninTest, DisplayBasicLogin) { |
+TEST_F(SyncHandlerFirstSigninTest, DisplayBasicLogin) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(false)); |
@@ -321,7 +322,7 @@ TEST_F(SyncSetupHandlerFirstSigninTest, DisplayBasicLogin) { |
profile_.get())->current_login_ui()); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { |
+TEST_F(SyncHandlerTest, ShowSyncSetupWhenNotSignedIn) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(false)); |
@@ -343,7 +344,7 @@ TEST_F(SyncSetupHandlerTest, ShowSyncSetupWhenNotSignedIn) { |
// Verifies that the sync setup is terminated correctly when the |
// sync is disabled. |
-TEST_F(SyncSetupHandlerTest, HandleSetupUIWhenSyncDisabled) { |
+TEST_F(SyncHandlerTest, HandleSetupUIWhenSyncDisabled) { |
EXPECT_CALL(*mock_pss_, IsManaged()).WillRepeatedly(Return(true)); |
handler_->HandleShowSetupUI(NULL); |
@@ -356,7 +357,7 @@ TEST_F(SyncSetupHandlerTest, HandleSetupUIWhenSyncDisabled) { |
// Verifies that the handler correctly handles a cancellation when |
// it is displaying the spinner to the user. |
-TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
+TEST_F(SyncHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(true)); |
@@ -381,7 +382,7 @@ TEST_F(SyncSetupHandlerTest, DisplayConfigureWithBackendDisabledAndCancel) { |
// Verifies that the handler correctly transitions from showing the spinner |
// to showing a configuration page when sync setup completes successfully. |
-TEST_F(SyncSetupHandlerTest, |
+TEST_F(SyncHandlerTest, |
DisplayConfigureWithBackendDisabledAndSyncStartupCompleted) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
@@ -432,7 +433,7 @@ TEST_F(SyncSetupHandlerTest, |
// configuration page, tested by |
// DisplayConfigureWithBackendDisabledAndSigninSuccess), but before the user |
// before the user has continued on. |
-TEST_F(SyncSetupHandlerTest, |
+TEST_F(SyncHandlerTest, |
DisplayConfigureWithBackendDisabledAndCancelAfterSigninSuccess) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
@@ -458,7 +459,7 @@ TEST_F(SyncSetupHandlerTest, |
profile_.get())->current_login_ui()); |
} |
-TEST_F(SyncSetupHandlerTest, |
+TEST_F(SyncHandlerTest, |
DisplayConfigureWithBackendDisabledAndSigninFailed) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
@@ -488,12 +489,12 @@ TEST_F(SyncSetupHandlerTest, |
#if !defined(OS_CHROMEOS) |
-class SyncSetupHandlerNonCrosTest : public SyncSetupHandlerTest { |
+class SyncHandlerNonCrosTest : public SyncHandlerTest { |
public: |
- SyncSetupHandlerNonCrosTest() {} |
+ SyncHandlerNonCrosTest() {} |
}; |
-TEST_F(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { |
+TEST_F(SyncHandlerNonCrosTest, HandleGaiaAuthFailure) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(false)); |
@@ -508,7 +509,7 @@ TEST_F(SyncSetupHandlerNonCrosTest, HandleGaiaAuthFailure) { |
} |
// TODO(kochi): We need equivalent tests for ChromeOS. |
-TEST_F(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { |
+TEST_F(SyncHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(false)); |
@@ -520,7 +521,7 @@ TEST_F(SyncSetupHandlerNonCrosTest, UnrecoverableErrorInitializingSync) { |
ASSERT_FALSE(handler_->is_configuring_sync()); |
} |
-TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { |
+TEST_F(SyncHandlerNonCrosTest, GaiaErrorInitializingSync) { |
EXPECT_CALL(*mock_pss_, CanSyncStart()).WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsOAuthRefreshTokenAvailable()) |
.WillRepeatedly(Return(false)); |
@@ -534,7 +535,7 @@ TEST_F(SyncSetupHandlerNonCrosTest, GaiaErrorInitializingSync) { |
#endif // #if !defined(OS_CHROMEOS) |
-TEST_F(SyncSetupHandlerTest, TestSyncEverything) { |
+TEST_F(SyncHandlerTest, TestSyncEverything) { |
std::string args = GetConfiguration( |
NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); |
base::ListValue list_args; |
@@ -552,7 +553,7 @@ TEST_F(SyncSetupHandlerTest, TestSyncEverything) { |
ExpectDone(); |
} |
-TEST_F(SyncSetupHandlerTest, TestSyncNothing) { |
+TEST_F(SyncHandlerTest, TestSyncNothing) { |
std::string args = GetConfiguration( |
NULL, SYNC_NOTHING, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); |
base::ListValue list_args; |
@@ -567,7 +568,7 @@ TEST_F(SyncSetupHandlerTest, TestSyncNothing) { |
EXPECT_EQ("SyncSetupOverlay.showSyncSetupPage", data.function_name()); |
} |
-TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) { |
+TEST_F(SyncHandlerTest, TurnOnEncryptAll) { |
std::string args = GetConfiguration( |
NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); |
base::ListValue list_args; |
@@ -588,7 +589,7 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) { |
ExpectDone(); |
} |
-TEST_F(SyncSetupHandlerTest, TestPassphraseStillRequired) { |
+TEST_F(SyncHandlerTest, TestPassphraseStillRequired) { |
std::string args = GetConfiguration( |
NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_PASSWORDS); |
base::ListValue list_args; |
@@ -609,7 +610,7 @@ TEST_F(SyncSetupHandlerTest, TestPassphraseStillRequired) { |
ExpectConfig(); |
} |
-TEST_F(SyncSetupHandlerTest, SuccessfullySetPassphrase) { |
+TEST_F(SyncHandlerTest, SuccessfullySetPassphrase) { |
base::DictionaryValue dict; |
dict.SetBoolean("isGooglePassphrase", true); |
std::string args = GetConfiguration(&dict, |
@@ -636,7 +637,7 @@ TEST_F(SyncSetupHandlerTest, SuccessfullySetPassphrase) { |
ExpectDone(); |
} |
-TEST_F(SyncSetupHandlerTest, SelectCustomEncryption) { |
+TEST_F(SyncHandlerTest, SelectCustomEncryption) { |
base::DictionaryValue dict; |
dict.SetBoolean("isGooglePassphrase", false); |
std::string args = GetConfiguration(&dict, |
@@ -663,7 +664,7 @@ TEST_F(SyncSetupHandlerTest, SelectCustomEncryption) { |
ExpectDone(); |
} |
-TEST_F(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) { |
+TEST_F(SyncHandlerTest, UnsuccessfullySetPassphrase) { |
base::DictionaryValue dict; |
dict.SetBoolean("isGooglePassphrase", true); |
std::string args = GetConfiguration(&dict, |
@@ -700,7 +701,7 @@ TEST_F(SyncSetupHandlerTest, UnsuccessfullySetPassphrase) { |
// Walks through each user selectable type, and tries to sync just that single |
// data type. |
-TEST_F(SyncSetupHandlerTest, TestSyncIndividualTypes) { |
+TEST_F(SyncHandlerTest, TestSyncIndividualTypes) { |
syncer::ModelTypeSet user_selectable_types = GetAllTypes(); |
syncer::ModelTypeSet::Iterator it; |
for (it = user_selectable_types.First(); it.Good(); it.Inc()) { |
@@ -728,7 +729,7 @@ TEST_F(SyncSetupHandlerTest, TestSyncIndividualTypes) { |
} |
} |
-TEST_F(SyncSetupHandlerTest, TestSyncAllManually) { |
+TEST_F(SyncHandlerTest, TestSyncAllManually) { |
std::string args = GetConfiguration(NULL, |
CHOOSE_WHAT_TO_SYNC, |
GetAllTypes(), |
@@ -748,7 +749,7 @@ TEST_F(SyncSetupHandlerTest, TestSyncAllManually) { |
ExpectDone(); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSyncSetup) { |
+TEST_F(SyncHandlerTest, ShowSyncSetup) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -762,7 +763,7 @@ TEST_F(SyncSetupHandlerTest, ShowSyncSetup) { |
} |
// We do not display signin on chromeos in the case of auth error. |
-TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { |
+TEST_F(SyncHandlerTest, ShowSigninOnAuthError) { |
// Initialize the system to a signed in state, but with an auth error. |
error_ = GoogleServiceAuthError( |
GoogleServiceAuthError::INVALID_GAIA_CREDENTIALS); |
@@ -804,7 +805,7 @@ TEST_F(SyncSetupHandlerTest, ShowSigninOnAuthError) { |
#endif |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupSyncEverything) { |
+TEST_F(SyncHandlerTest, ShowSetupSyncEverything) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -836,7 +837,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupSyncEverything) { |
CheckConfigDataTypeArguments(dictionary, SYNC_ALL_DATA, GetAllTypes()); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { |
+TEST_F(SyncHandlerTest, ShowSetupManuallySyncAll) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -855,7 +856,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupManuallySyncAll) { |
CheckConfigDataTypeArguments(dictionary, CHOOSE_WHAT_TO_SYNC, GetAllTypes()); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { |
+TEST_F(SyncHandlerTest, ShowSetupSyncForAllTypesIndividually) { |
syncer::ModelTypeSet user_selectable_types = GetAllTypes(); |
syncer::ModelTypeSet::Iterator it; |
for (it = user_selectable_types.First(); it.Good(); it.Inc()) { |
@@ -889,7 +890,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupSyncForAllTypesIndividually) { |
} |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupGaiaPassphraseRequired) { |
+TEST_F(SyncHandlerTest, ShowSetupGaiaPassphraseRequired) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -909,7 +910,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupGaiaPassphraseRequired) { |
CheckBool(dictionary, "passphraseFailed", false); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { |
+TEST_F(SyncHandlerTest, ShowSetupCustomPassphraseRequired) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(true)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -931,7 +932,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupCustomPassphraseRequired) { |
CheckBool(dictionary, "passphraseFailed", false); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) { |
+TEST_F(SyncHandlerTest, ShowSetupEncryptAll) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -951,7 +952,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) { |
CheckBool(dictionary, "encryptAllData", true); |
} |
-TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) { |
+TEST_F(SyncHandlerTest, ShowSetupEncryptAllDisallowed) { |
EXPECT_CALL(*mock_pss_, IsPassphraseRequired()) |
.WillRepeatedly(Return(false)); |
EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase()) |
@@ -972,7 +973,7 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) { |
CheckBool(dictionary, "encryptAllDataAllowed", false); |
} |
-TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) { |
+TEST_F(SyncHandlerTest, TurnOnEncryptAllDisallowed) { |
std::string args = GetConfiguration( |
NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA); |
base::ListValue list_args; |
@@ -993,3 +994,4 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) { |
ExpectDone(); |
} |
+} // namespace settings |