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

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

Issue 10701041: implement sign in dialog (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Created 8 years, 5 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
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/identity/identity_apitest.cc
===================================================================
--- chrome/browser/extensions/api/identity/identity_apitest.cc (revision 146190)
+++ chrome/browser/extensions/api/identity/identity_apitest.cc (working copy)
@@ -2,14 +2,24 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+#include "base/values.h"
#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/browser/extensions/extension_function_test_utils.h"
+#include "chrome/browser/ui/webui/signin/login_ui_service.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 "chrome/test/base/in_process_browser_test.h"
#include "googleurl/src/gurl.h"
+#include "testing/gmock/include/gmock/gmock.h"
+#include "testing/gtest/include/gtest/gtest.h"
+using testing::ReturnRef;
+
+namespace utils = extension_function_test_utils;
+
namespace {
class IdentityInterceptor : public OAuth2MintTokenFlow::InterceptorForTests {
@@ -46,6 +56,16 @@
bool called_;
};
+class MockGetAuthTokenFunction : public extensions::GetAuthTokenFunction {
+ public:
+ void ShowLoginPopup() {
+ // Do nothing in tests.
+ }
+ MOCK_CONST_METHOD0(HasLoginToken, bool ());
+ MOCK_CONST_METHOD0(GetOAuth2Info,
+ const extensions::Extension::OAuth2Info& ());
+};
+
} // namespace
IN_PROC_BROWSER_TEST_F(PlatformAppApiTest, Identity) {
@@ -57,3 +77,17 @@
ASSERT_TRUE(id_interceptor.called());
ASSERT_TRUE(waf_interceptor.called());
};
+
+IN_PROC_BROWSER_TEST_F(PlatformAppApiTest, GetAuthToken) {
+ scoped_refptr<MockGetAuthTokenFunction> func(new MockGetAuthTokenFunction());
+ extensions::Extension::OAuth2Info oauth2_info;
+ ON_CALL(*func.get(), GetOAuth2Info()).WillByDefault(ReturnRef(oauth2_info));
+ // Without a callback the function will not generate a result.
+ func->set_has_callback(true);
+ std::string error = utils::RunFunctionAndReturnError(
+ func.get(), "[]", browser());
+ // scoped_ptr<base::Value> result(utils::RunFunctionAndReturnResult(
+ // func.get(), "{}", browser()));
+}
+
+
« no previous file with comments | « chrome/browser/extensions/api/identity/identity_api.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698