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

Side by Side Diff: chrome/browser/extensions/api/identity/gaia_web_auth_flow_unittest.cc

Issue 15897006: Identity API: switch WebAuthFlow dialog to component app (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 7 years, 7 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 unified diff | Download patch
OLDNEW
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 "content/public/test/test_browser_thread.h" 10 #include "content/public/test/test_browser_thread.h"
11 #include "testing/gmock/include/gmock/gmock.h" 11 #include "testing/gmock/include/gmock/gmock.h"
12 #include "testing/gtest/include/gtest/gtest.h" 12 #include "testing/gtest/include/gtest/gtest.h"
13 13
14 namespace extensions { 14 namespace extensions {
15 15
16 class FakeWebAuthFlow : public WebAuthFlow { 16 class FakeWebAuthFlow : public WebAuthFlow {
17 public: 17 public:
18 explicit FakeWebAuthFlow(WebAuthFlow::Delegate* delegate) 18 explicit FakeWebAuthFlow(WebAuthFlow::Delegate* delegate)
19 : WebAuthFlow(delegate, 19 : WebAuthFlow(delegate,
20 NULL, 20 NULL,
21 GURL(), 21 GURL(),
22 WebAuthFlow::INTERACTIVE, 22 WebAuthFlow::INTERACTIVE) {}
23 gfx::Rect(),
24 chrome::GetActiveDesktop()) {}
25 23
26 virtual void Start() OVERRIDE {} 24 virtual void Start() OVERRIDE {}
27 }; 25 };
28 26
29 class TestGaiaWebAuthFlow : public GaiaWebAuthFlow { 27 class TestGaiaWebAuthFlow : public GaiaWebAuthFlow {
30 public: 28 public:
31 TestGaiaWebAuthFlow(GaiaWebAuthFlow::Delegate* delegate, 29 TestGaiaWebAuthFlow(GaiaWebAuthFlow::Delegate* delegate,
32 const std::string& extension_id, 30 const std::string& extension_id,
33 const OAuth2Info& oauth2_info, 31 const OAuth2Info& oauth2_info,
34 GoogleServiceAuthError::State ubertoken_error_state) 32 GoogleServiceAuthError::State ubertoken_error_state)
35 : GaiaWebAuthFlow(delegate, 33 : GaiaWebAuthFlow(delegate,
36 NULL, 34 NULL,
37 chrome::GetActiveDesktop(),
38 "extension_id", 35 "extension_id",
39 oauth2_info), 36 oauth2_info),
40 ubertoken_error_(ubertoken_error_state) {} 37 ubertoken_error_(ubertoken_error_state) {}
41 38
42 virtual void Start() OVERRIDE { 39 virtual void Start() OVERRIDE {
43 if (ubertoken_error_.state() == GoogleServiceAuthError::NONE) 40 if (ubertoken_error_.state() == GoogleServiceAuthError::NONE)
44 OnUbertokenSuccess("fake_ubertoken"); 41 OnUbertokenSuccess("fake_ubertoken");
45 else 42 else
46 OnUbertokenFailure(ubertoken_error_); 43 OnUbertokenFailure(ubertoken_error_);
47 } 44 }
(...skipping 183 matching lines...) Expand 10 before | Expand all | Expand 10 after
231 EXPECT_CALL( 228 EXPECT_CALL(
232 delegate_, 229 delegate_,
233 OnGaiaFlowFailure( 230 OnGaiaFlowFailure(
234 GaiaWebAuthFlow::WINDOW_CLOSED, 231 GaiaWebAuthFlow::WINDOW_CLOSED,
235 GoogleServiceAuthError(GoogleServiceAuthError::NONE), 232 GoogleServiceAuthError(GoogleServiceAuthError::NONE),
236 "")); 233 ""));
237 flow->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED); 234 flow->OnAuthFlowFailure(WebAuthFlow::WINDOW_CLOSED);
238 } 235 }
239 236
240 } // namespace extensions 237 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698