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

Unified Diff: jingle/notifier/communicator/single_login_attempt_unittest.cc

Issue 10545170: [Sync] Propagate XMPP auth errors to SyncNotifierObservers (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix compile error Created 8 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: 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

Powered by Google App Engine
This is Rietveld 408576698