OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 "base/string_util.h" | 5 #include "base/string_util.h" |
6 #include "base/stringprintf.h" | 6 #include "base/stringprintf.h" |
7 #include "base/values.h" | 7 #include "base/values.h" |
8 #include "chrome/browser/extensions/api/identity/identity_api.h" | 8 #include "chrome/browser/extensions/api/identity/identity_api.h" |
9 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" | 9 #include "chrome/browser/extensions/api/identity/web_auth_flow.h" |
10 #include "chrome/browser/extensions/extension_apitest.h" | 10 #include "chrome/browser/extensions/extension_apitest.h" |
(...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
150 ManifestHandler::Register(extension_manifest_keys::kOAuth2, | 150 ManifestHandler::Register(extension_manifest_keys::kOAuth2, |
151 make_linked_ptr(new OAuth2ManifestHandler)); | 151 make_linked_ptr(new OAuth2ManifestHandler)); |
152 } | 152 } |
153 protected: | 153 protected: |
154 enum OAuth2Fields { | 154 enum OAuth2Fields { |
155 NONE = 0, | 155 NONE = 0, |
156 CLIENT_ID = 1, | 156 CLIENT_ID = 1, |
157 SCOPES = 2 | 157 SCOPES = 2 |
158 }; | 158 }; |
159 | 159 |
160 ~GetAuthTokenFunctionTest() {} | 160 virtual ~GetAuthTokenFunctionTest() {} |
161 | 161 |
162 // Helper to create an extension with specific OAuth2Info fields set. | 162 // Helper to create an extension with specific OAuth2Info fields set. |
163 // |fields_to_set| should be computed by using fields of Oauth2Fields enum. | 163 // |fields_to_set| should be computed by using fields of Oauth2Fields enum. |
164 const Extension* CreateExtension(int fields_to_set) { | 164 const Extension* CreateExtension(int fields_to_set) { |
165 const Extension* ext = LoadExtension( | 165 const Extension* ext = LoadExtension( |
166 test_data_dir_.AppendASCII("platform_apps/oauth2")); | 166 test_data_dir_.AppendASCII("platform_apps/oauth2")); |
167 OAuth2Info& oauth2_info = const_cast<OAuth2Info&>( | 167 OAuth2Info& oauth2_info = const_cast<OAuth2Info&>( |
168 OAuth2Info::GetOAuth2Info(ext)); | 168 OAuth2Info::GetOAuth2Info(ext)); |
169 if ((fields_to_set & CLIENT_ID) != 0) | 169 if ((fields_to_set & CLIENT_ID) != 0) |
170 oauth2_info.client_id = "client1"; | 170 oauth2_info.client_id = "client1"; |
(...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, Bounds) { | 455 IN_PROC_BROWSER_TEST_F(LaunchWebAuthFlowFunctionTest, Bounds) { |
456 RunAndCheckBounds("", 0, 0, 0, 0); | 456 RunAndCheckBounds("", 0, 0, 0, 0); |
457 RunAndCheckBounds("\"width\": 100, \"height\": 200", 0, 0, 100, 200); | 457 RunAndCheckBounds("\"width\": 100, \"height\": 200", 0, 0, 100, 200); |
458 RunAndCheckBounds("\"left\": 100, \"top\": 200", 100, 200, 0, 0); | 458 RunAndCheckBounds("\"left\": 100, \"top\": 200", 100, 200, 0, 0); |
459 RunAndCheckBounds( | 459 RunAndCheckBounds( |
460 "\"left\": 100, \"top\": 200, \"width\": 300, \"height\": 400", | 460 "\"left\": 100, \"top\": 200, \"width\": 300, \"height\": 400", |
461 100, 200, 300, 400); | 461 100, 200, 300, 400); |
462 } | 462 } |
463 | 463 |
464 } // namespace extensions | 464 } // namespace extensions |
OLD | NEW |