| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h" | 5 #include "chrome/browser/extensions/api/identity/gaia_web_auth_flow.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/message_loop.h" | 9 #include "base/message_loop.h" |
| 10 #include "base/run_loop.h" | 10 #include "base/run_loop.h" |
| 11 #include "content/public/test/test_browser_thread.h" | 11 #include "content/public/test/test_browser_thread.h" |
| 12 #include "testing/gmock/include/gmock/gmock.h" | 12 #include "testing/gmock/include/gmock/gmock.h" |
| 13 #include "testing/gtest/include/gtest/gtest.h" | 13 #include "testing/gtest/include/gtest/gtest.h" |
| 14 | 14 |
| 15 namespace extensions { | 15 namespace extensions { |
| 16 | 16 |
| 17 class FakeWebAuthFlow : public WebAuthFlow { | 17 class FakeWebAuthFlow : public WebAuthFlow { |
| 18 public: | 18 public: |
| 19 explicit FakeWebAuthFlow(WebAuthFlow::Delegate* delegate) | 19 explicit FakeWebAuthFlow(WebAuthFlow::Delegate* delegate) |
| 20 : WebAuthFlow(delegate, | 20 : WebAuthFlow(delegate, |
| 21 NULL, | 21 NULL, |
| 22 GURL(), | 22 GURL(), |
| 23 WebAuthFlow::INTERACTIVE, | 23 WebAuthFlow::INTERACTIVE) {} |
| 24 gfx::Rect(), | |
| 25 chrome::GetActiveDesktop()) {} | |
| 26 | 24 |
| 27 virtual void Start() OVERRIDE {} | 25 virtual void Start() OVERRIDE {} |
| 28 }; | 26 }; |
| 29 | 27 |
| 30 class TestGaiaWebAuthFlow : public GaiaWebAuthFlow { | 28 class TestGaiaWebAuthFlow : public GaiaWebAuthFlow { |
| 31 public: | 29 public: |
| 32 TestGaiaWebAuthFlow(GaiaWebAuthFlow::Delegate* delegate, | 30 TestGaiaWebAuthFlow(GaiaWebAuthFlow::Delegate* delegate, |
| 33 const std::string& extension_id, | 31 const std::string& extension_id, |
| 34 const OAuth2Info& oauth2_info, | 32 const OAuth2Info& oauth2_info, |
| 35 GoogleServiceAuthError::State ubertoken_error_state) | 33 GoogleServiceAuthError::State ubertoken_error_state) |
| 36 : GaiaWebAuthFlow(delegate, | 34 : GaiaWebAuthFlow(delegate, |
| 37 NULL, | 35 NULL, |
| 38 chrome::GetActiveDesktop(), | |
| 39 "extension_id", | 36 "extension_id", |
| 40 oauth2_info), | 37 oauth2_info), |
| 41 ubertoken_error_(ubertoken_error_state) {} | 38 ubertoken_error_(ubertoken_error_state) {} |
| 42 | 39 |
| 43 virtual void Start() OVERRIDE { | 40 virtual void Start() OVERRIDE { |
| 44 if (ubertoken_error_.state() == GoogleServiceAuthError::NONE) | 41 if (ubertoken_error_.state() == GoogleServiceAuthError::NONE) |
| 45 OnUbertokenSuccess("fake_ubertoken"); | 42 OnUbertokenSuccess("fake_ubertoken"); |
| 46 else | 43 else |
| 47 OnUbertokenFailure(ubertoken_error_); | 44 OnUbertokenFailure(ubertoken_error_); |
| 48 } | 45 } |
| (...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 238 EXPECT_CALL( | 235 EXPECT_CALL( |
| 239 delegate_, | 236 delegate_, |
| 240 OnGaiaFlowFailure( | 237 OnGaiaFlowFailure( |
| 241 GaiaWebAuthFlow::WINDOW_CLOSED, | 238 GaiaWebAuthFlow::WINDOW_CLOSED, |
| 242 GoogleServiceAuthError(GoogleServiceAuthError::NONE), | 239 GoogleServiceAuthError(GoogleServiceAuthError::NONE), |
| 243 "")); | 240 "")); |
| 244 flow->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); | 241 flow->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); |
| 245 } | 242 } |
| 246 | 243 |
| 247 } // namespace extensions | 244 } // namespace extensions |
| OLD | NEW |