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

Unified Diff: chrome/browser/extensions/api/identity/identity_apitest.cc

Issue 10178020: Start implementing an auth flow for platform apps to be able to do auth (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 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 side-by-side diff with in-line comments
Download patch
Index: chrome/browser/extensions/api/identity/identity_apitest.cc
===================================================================
--- chrome/browser/extensions/api/identity/identity_apitest.cc (revision 137883)
+++ chrome/browser/extensions/api/identity/identity_apitest.cc (working copy)
@@ -3,34 +3,57 @@
// found in the LICENSE file.
#include "chrome/browser/extensions/api/identity/identity_api.h"
+#include "chrome/browser/extensions/api/identity/web_auth_flow.h"
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/common/net/gaia/google_service_auth_error.h"
#include "chrome/common/net/gaia/oauth2_mint_token_flow.h"
#include "chrome/common/chrome_switches.h"
+#include "googleurl/src/gurl.h"
namespace {
class IdentityInterceptor : public OAuth2MintTokenFlow::InterceptorForTests {
public:
+ IdentityInterceptor() : called_(false) { }
+
virtual bool DoIntercept(const OAuth2MintTokenFlow* flow,
std::string* access_token,
GoogleServiceAuthError* error) OVERRIDE {
*access_token = "auth_token";
- get_auth_token_called_ = true;
+ called_ = true;
return true;
}
- bool get_auth_token_called() const { return get_auth_token_called_; }
+ bool called() const { return called_; }
private:
- bool get_auth_token_called_;
+ bool called_;
};
+class WebAuthFlowInterceptor
+ : public extensions::WebAuthFlow::InterceptorForTests {
+ public:
+ WebAuthFlowInterceptor() : called_(false) { }
+
+ virtual GURL DoIntercept(const GURL& provider_url) OVERRIDE {
+ called_ = true;
+ return GURL("https://abcd.chromiumapp.org/cb#access_token=tok");
+ }
+
+ bool called() const { return called_; }
+
+ private:
+ bool called_;
+};
+
} // namespace
IN_PROC_BROWSER_TEST_F(PlatformAppApiTest, Identity) {
- IdentityInterceptor interceptor;
- OAuth2MintTokenFlow::SetInterceptorForTests(&interceptor);
+ IdentityInterceptor id_interceptor;
+ OAuth2MintTokenFlow::SetInterceptorForTests(&id_interceptor);
+ WebAuthFlowInterceptor waf_interceptor;
+ extensions::WebAuthFlow::SetInterceptorForTests(&waf_interceptor);
ASSERT_TRUE(RunExtensionTest("identity")) << message_;
- ASSERT_TRUE(interceptor.get_auth_token_called());
+ ASSERT_TRUE(id_interceptor.called());
+ ASSERT_TRUE(waf_interceptor.called());
};
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.cc ('k') | chrome/browser/extensions/api/identity/web_auth_flow.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698