| Index: chrome/browser/ui/webui/sync_setup_handler_unittest.cc
|
| diff --git a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
|
| index aeaeb5a76740481572623337e87aec833b45387a..ffede4b8fdd2098ded34388d48243335e677e7f3 100644
|
| --- a/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
|
| +++ b/chrome/browser/ui/webui/sync_setup_handler_unittest.cc
|
| @@ -304,6 +304,8 @@ class SyncSetupHandlerTest : public testing::Test {
|
| WillRepeatedly(Return(GetAllTypes()));
|
| EXPECT_CALL(*mock_pss_, GetActiveDataTypes()).
|
| WillRepeatedly(Return(GetAllTypes()));
|
| + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()).
|
| + WillRepeatedly(Return(true));
|
| EXPECT_CALL(*mock_pss_, EncryptEverythingEnabled()).
|
| WillRepeatedly(Return(false));
|
| }
|
| @@ -510,6 +512,7 @@ TEST_F(SyncSetupHandlerTest,
|
| CheckBool(dictionary, "passphraseFailed", false);
|
| CheckBool(dictionary, "showSyncEverythingPage", false);
|
| CheckBool(dictionary, "syncAllDataTypes", true);
|
| + CheckBool(dictionary, "encryptAllDataAllowed", true);
|
| CheckBool(dictionary, "encryptAllData", false);
|
| CheckBool(dictionary, "usePassphrase", false);
|
| }
|
| @@ -668,6 +671,8 @@ TEST_F(SyncSetupHandlerTest, TurnOnEncryptAll) {
|
| .WillRepeatedly(Return(false));
|
| EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
|
| .WillRepeatedly(Return(false));
|
| + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed())
|
| + .WillRepeatedly(Return(true));
|
| SetupInitializedProfileSyncService();
|
| EXPECT_CALL(*mock_pss_, EnableEncryptEverything());
|
| EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _));
|
| @@ -1042,3 +1047,46 @@ TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAll) {
|
| ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary));
|
| CheckBool(dictionary, "encryptAllData", true);
|
| }
|
| +
|
| +TEST_F(SyncSetupHandlerTest, ShowSetupEncryptAllDisallowed) {
|
| + EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
|
| + .WillRepeatedly(Return(false));
|
| + EXPECT_CALL(*mock_pss_, IsUsingSecondaryPassphrase())
|
| + .WillRepeatedly(Return(false));
|
| + SetupInitializedProfileSyncService();
|
| + SetDefaultExpectationsForConfigPage();
|
| + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()).
|
| + WillRepeatedly(Return(false));
|
| +
|
| + // This should display the sync setup dialog (not login).
|
| + handler_->OpenSyncSetup();
|
| +
|
| + ExpectConfig();
|
| + const TestWebUI::CallData& data = web_ui_.call_data()[0];
|
| + base::DictionaryValue* dictionary;
|
| + ASSERT_TRUE(data.arg2->GetAsDictionary(&dictionary));
|
| + CheckBool(dictionary, "encryptAllData", false);
|
| + CheckBool(dictionary, "encryptAllDataAllowed", false);
|
| +}
|
| +
|
| +TEST_F(SyncSetupHandlerTest, TurnOnEncryptAllDisallowed) {
|
| + std::string args = GetConfiguration(
|
| + NULL, SYNC_ALL_DATA, GetAllTypes(), std::string(), ENCRYPT_ALL_DATA);
|
| + base::ListValue list_args;
|
| + list_args.Append(new base::StringValue(args));
|
| + EXPECT_CALL(*mock_pss_, IsPassphraseRequiredForDecryption())
|
| + .WillRepeatedly(Return(false));
|
| + EXPECT_CALL(*mock_pss_, IsPassphraseRequired())
|
| + .WillRepeatedly(Return(false));
|
| + SetupInitializedProfileSyncService();
|
| + EXPECT_CALL(*mock_pss_, EncryptEverythingAllowed()).
|
| + WillRepeatedly(Return(false));
|
| + EXPECT_CALL(*mock_pss_, EnableEncryptEverything()).Times(0);
|
| + EXPECT_CALL(*mock_pss_, OnUserChoseDatatypes(true, _));
|
| + handler_->HandleConfigure(&list_args);
|
| +
|
| + // Ensure that we navigated to the "done" state since we don't need a
|
| + // passphrase.
|
| + ExpectDone();
|
| +}
|
| +
|
|
|