| Index: remoting/host/it2me/it2me_host_unittest.cc
|
| diff --git a/remoting/host/it2me/it2me_host_unittest.cc b/remoting/host/it2me/it2me_host_unittest.cc
|
| index de3613f34f071379895310c87b4d8b9de28dea89..ef53af73b0c26cbf4f098d662deb74fcfa1dc59b 100644
|
| --- a/remoting/host/it2me/it2me_host_unittest.cc
|
| +++ b/remoting/host/it2me/it2me_host_unittest.cc
|
| @@ -127,7 +127,7 @@
|
| ValidationResult validation_result_ = ValidationResult::SUCCESS;
|
|
|
| // Used to set ConfirmationDialog behavior.
|
| - FakeIt2MeConfirmationDialog* dialog_ = nullptr;
|
| + FakeIt2MeConfirmationDialogFactory* fake_dialog_factory_ = nullptr;
|
|
|
| private:
|
| std::unique_ptr<base::MessageLoop> message_loop_;
|
| @@ -145,18 +145,13 @@
|
| message_loop_.reset(new base::MessageLoop());
|
| run_loop_.reset(new base::RunLoop());
|
|
|
| - std::unique_ptr<FakeIt2MeConfirmationDialogFactory> fake_dialog_factory(
|
| - new FakeIt2MeConfirmationDialogFactory());
|
| - dialog_ = new FakeIt2MeConfirmationDialog();
|
| - fake_dialog_factory->set_confirmation_dialog(base::WrapUnique(dialog_));
|
| -
|
| + fake_dialog_factory_ = new FakeIt2MeConfirmationDialogFactory();
|
| scoped_refptr<AutoThreadTaskRunner> auto_thread_task_runner =
|
| new AutoThreadTaskRunner(base::ThreadTaskRunnerHandle::Get(),
|
| run_loop_->QuitClosure());
|
| -
|
| it2me_host_ = new It2MeHost(
|
| ChromotingHostContext::Create(auto_thread_task_runner),
|
| - /*policy_watcher=*/nullptr, std::move(fake_dialog_factory),
|
| + /*policy_watcher=*/nullptr, base::WrapUnique(fake_dialog_factory_),
|
| /*observer=*/nullptr, xmpp_server_config_, directory_bot_jid_);
|
| }
|
|
|
| @@ -247,17 +242,28 @@
|
| ASSERT_EQ(ValidationResult::ERROR_INVALID_ACCOUNT, validation_result_);
|
| }
|
|
|
| +TEST_F(It2MeHostTest, ConnectionValidation_ConfirmationDialog_NoDialog) {
|
| + RunValidationCallback(kTestClientJid);
|
| + ASSERT_EQ(ValidationResult::SUCCESS, validation_result_);
|
| +}
|
| +
|
| TEST_F(It2MeHostTest, ConnectionValidation_ConfirmationDialog_Accept) {
|
| - RunValidationCallback(kTestClientJid);
|
| - ASSERT_EQ(ValidationResult::SUCCESS, validation_result_);
|
| - ASSERT_STREQ(kTestClientUserName, dialog_->get_remote_user_email().c_str());
|
| + FakeIt2MeConfirmationDialog* dialog = new FakeIt2MeConfirmationDialog();
|
| + fake_dialog_factory_->set_confirmation_dialog(base::WrapUnique(dialog));
|
| +
|
| + RunValidationCallback(kTestClientJid);
|
| + ASSERT_EQ(ValidationResult::SUCCESS, validation_result_);
|
| + ASSERT_STREQ(kTestClientUserName, dialog->get_remote_user_email().c_str());
|
| }
|
|
|
| TEST_F(It2MeHostTest, ConnectionValidation_ConfirmationDialog_Reject) {
|
| - dialog_->set_dialog_result(DialogResult::CANCEL);
|
| + FakeIt2MeConfirmationDialog* dialog = new FakeIt2MeConfirmationDialog();
|
| + dialog->set_dialog_result(DialogResult::CANCEL);
|
| + fake_dialog_factory_->set_confirmation_dialog(base::WrapUnique(dialog));
|
| +
|
| RunValidationCallback(kTestClientJid);
|
| ASSERT_EQ(ValidationResult::ERROR_REJECTED_BY_USER, validation_result_);
|
| - ASSERT_STREQ(kTestClientUserName, dialog_->get_remote_user_email().c_str());
|
| + ASSERT_STREQ(kTestClientUserName, dialog->get_remote_user_email().c_str());
|
| }
|
|
|
| } // namespace remoting
|
|
|