| Index: jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| diff --git a/jingle/notifier/communicator/single_login_attempt_unittest.cc b/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| index 700b11789046071df87aeb34af744fddbd9d5150..e214528ec12108e4a5a5a9d3d0a51c3f236d9fc9 100644
|
| --- a/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| +++ b/jingle/notifier/communicator/single_login_attempt_unittest.cc
|
| @@ -27,18 +27,21 @@ namespace notifier {
|
|
|
| namespace {
|
|
|
| -enum DelegateState { IDLE, CONNECTED, NEED_RECONNECT, REDIRECTED };
|
| +enum DelegateState {
|
| + IDLE, CONNECTED, NEED_RECONNECT, REDIRECTED, REJECTED_CREDENTIALS
|
| +};
|
|
|
| class FakeDelegate : public SingleLoginAttempt::Delegate {
|
| public:
|
| FakeDelegate() : state_(IDLE) {}
|
|
|
| - void OnConnect(base::WeakPtr<buzz::XmppTaskParentInterface> base_task) {
|
| + void OnConnect(
|
| + base::WeakPtr<buzz::XmppTaskParentInterface> base_task) OVERRIDE {
|
| state_ = CONNECTED;
|
| base_task_ = base_task;
|
| }
|
|
|
| - virtual void OnNeedReconnect() {
|
| + virtual void OnNeedReconnect() OVERRIDE {
|
| state_ = NEED_RECONNECT;
|
| }
|
|
|
| @@ -47,6 +50,10 @@ class FakeDelegate : public SingleLoginAttempt::Delegate {
|
| redirect_server_ = redirect_server;
|
| }
|
|
|
| + virtual void OnRejectedCredentials() OVERRIDE {
|
| + state_ = REJECTED_CREDENTIALS;
|
| + }
|
| +
|
| DelegateState state() const { return state_; }
|
|
|
| base::WeakPtr<buzz::XmppTaskParentInterface> base_task() const {
|
| @@ -233,6 +240,13 @@ TEST_F(SingleLoginAttemptTest, RedirectMissingSeeOtherHost) {
|
| EXPECT_EQ(IDLE, fake_delegate_.state());
|
| }
|
|
|
| +// Fire 'Unauthorized' errors and make sure the delegate gets the
|
| +// OnRejectedCredentials() event.
|
| +TEST_F(SingleLoginAttemptTest, RejectedCredentials) {
|
| + attempt_.OnError(buzz::XmppEngine::ERROR_UNAUTHORIZED, 0, NULL);
|
| + EXPECT_EQ(REJECTED_CREDENTIALS, fake_delegate_.state());
|
| +}
|
| +
|
| } // namespace
|
|
|
| } // namespace notifier
|
|
|