| OLD | NEW |
| 1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
| 4 | 4 |
| 5 package org.chromium.blimp.auth; | 5 package org.chromium.blimp.app.auth; |
| 6 | 6 |
| 7 import android.content.Intent; | 7 import android.content.Intent; |
| 8 import android.os.Handler; | 8 import android.os.Handler; |
| 9 import android.os.Message; | 9 import android.os.Message; |
| 10 | 10 |
| 11 import com.google.android.gms.common.ConnectionResult; | 11 import com.google.android.gms.common.ConnectionResult; |
| 12 | 12 |
| 13 import junit.framework.Assert; | 13 import junit.framework.Assert; |
| 14 | 14 |
| 15 /** | 15 /** |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 @Override | 56 @Override |
| 57 public void setCallback(TokenSource.Callback callback) { | 57 public void setCallback(TokenSource.Callback callback) { |
| 58 mCallback = callback; | 58 mCallback = callback; |
| 59 } | 59 } |
| 60 | 60 |
| 61 @Override | 61 @Override |
| 62 public void getToken() { | 62 public void getToken() { |
| 63 Assert.assertFalse("getToken() called after already returning a successf
ul token.", | 63 Assert.assertFalse("getToken() called after already returning a successf
ul token.", |
| 64 isRetrievingToken()); | 64 isRetrievingToken()); |
| 65 Assert.assertFalse("getToken() called after failing in an unrecoverable
way.", | 65 Assert.assertFalse( |
| 66 mAlreadyFailedHard); | 66 "getToken() called after failing in an unrecoverable way.", mAlr
eadyFailedHard); |
| 67 sendEmptyMessage(MSG_QUERY_TOKEN); | 67 sendEmptyMessage(MSG_QUERY_TOKEN); |
| 68 } | 68 } |
| 69 | 69 |
| 70 @Override | 70 @Override |
| 71 public boolean isRetrievingToken() { | 71 public boolean isRetrievingToken() { |
| 72 return hasMessages(MSG_QUERY_TOKEN); | 72 return hasMessages(MSG_QUERY_TOKEN); |
| 73 } | 73 } |
| 74 | 74 |
| 75 @Override | 75 @Override |
| 76 public int tokenIsInvalid(String token) { | 76 public int tokenIsInvalid(String token) { |
| (...skipping 11 matching lines...) Expand all Loading... |
| 88 mCallback.onTokenUnavailable(true); | 88 mCallback.onTokenUnavailable(true); |
| 89 } else if (mFailHard) { | 89 } else if (mFailHard) { |
| 90 mAlreadyFailedHard = true; | 90 mAlreadyFailedHard = true; |
| 91 mCallback.onTokenUnavailable(false); | 91 mCallback.onTokenUnavailable(false); |
| 92 } else { | 92 } else { |
| 93 mCallback.onTokenReceived(mCorrectToken); | 93 mCallback.onTokenReceived(mCorrectToken); |
| 94 } | 94 } |
| 95 --mTransientFailuresLeft; | 95 --mTransientFailuresLeft; |
| 96 } | 96 } |
| 97 } | 97 } |
| OLD | NEW |