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 <set> | 5 #include <set> |
6 #include <string> | 6 #include <string> |
7 #include <vector> | 7 #include <vector> |
8 | 8 |
9 #include "base/command_line.h" | 9 #include "base/command_line.h" |
10 #include "base/strings/string_util.h" | 10 #include "base/strings/string_util.h" |
11 #include "base/strings/stringprintf.h" | 11 #include "base/strings/stringprintf.h" |
12 #include "base/values.h" | 12 #include "base/values.h" |
13 #include "chrome/browser/chrome_notification_types.h" | 13 #include "chrome/browser/chrome_notification_types.h" |
14 #include "chrome/browser/extensions/api/identity/identity_api.h" | 14 #include "chrome/browser/extensions/api/identity/identity_api.h" |
15 #include "chrome/browser/extensions/component_loader.h" | 15 #include "chrome/browser/extensions/component_loader.h" |
16 #include "chrome/browser/extensions/extension_apitest.h" | 16 #include "chrome/browser/extensions/extension_apitest.h" |
17 #include "chrome/browser/extensions/extension_browsertest.h" | 17 #include "chrome/browser/extensions/extension_browsertest.h" |
18 #include "chrome/browser/extensions/extension_function_test_utils.h" | 18 #include "chrome/browser/extensions/extension_function_test_utils.h" |
19 #include "chrome/browser/extensions/extension_service.h" | 19 #include "chrome/browser/extensions/extension_service.h" |
| 20 #include "chrome/browser/guest_view/guest_view_base.h" |
20 #include "chrome/browser/profiles/profile.h" | 21 #include "chrome/browser/profiles/profile.h" |
21 #include "chrome/browser/signin/signin_manager_factory.h" | 22 #include "chrome/browser/signin/signin_manager_factory.h" |
22 #include "chrome/browser/ui/browser.h" | 23 #include "chrome/browser/ui/browser.h" |
23 #include "chrome/browser/ui/browser_window.h" | 24 #include "chrome/browser/ui/browser_window.h" |
24 #include "chrome/common/chrome_switches.h" | 25 #include "chrome/common/chrome_switches.h" |
25 #include "chrome/common/extensions/api/identity.h" | 26 #include "chrome/common/extensions/api/identity.h" |
26 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" | 27 #include "chrome/common/extensions/api/identity/oauth2_manifest_handler.h" |
27 #include "chrome/test/base/in_process_browser_test.h" | 28 #include "chrome/test/base/in_process_browser_test.h" |
28 #include "chrome/test/base/test_switches.h" | 29 #include "chrome/test/base/test_switches.h" |
29 #include "components/signin/core/browser/signin_manager.h" | 30 #include "components/signin/core/browser/signin_manager.h" |
(...skipping 200 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
230 const content::NotificationDetails& details) OVERRIDE { | 231 const content::NotificationDetails& details) OVERRIDE { |
231 content::NavigationController* web_auth_flow_controller = | 232 content::NavigationController* web_auth_flow_controller = |
232 content::Source<content::NavigationController>(source).ptr(); | 233 content::Source<content::NavigationController>(source).ptr(); |
233 content::WebContents* web_contents = | 234 content::WebContents* web_contents = |
234 web_auth_flow_controller->GetWebContents(); | 235 web_auth_flow_controller->GetWebContents(); |
235 | 236 |
236 if (web_contents->GetURL() == url_) { | 237 if (web_contents->GetURL() == url_) { |
237 // It is safe to keep the pointer here, because we know in a test, that | 238 // It is safe to keep the pointer here, because we know in a test, that |
238 // the WebContents won't go away before CloseEmbedderWebContents is | 239 // the WebContents won't go away before CloseEmbedderWebContents is |
239 // called. Don't copy this code to production. | 240 // called. Don't copy this code to production. |
240 embedder_web_contents_ = web_contents->GetEmbedderWebContents(); | 241 GuestViewBase* guest = GuestViewBase::FromWebContents(web_contents); |
| 242 embedder_web_contents_ = guest->embedder_web_contents(); |
241 // Condtionally invoke parent class so that Wait will not exit | 243 // Condtionally invoke parent class so that Wait will not exit |
242 // until the target URL arrives. | 244 // until the target URL arrives. |
243 content::WindowedNotificationObserver::Observe(type, source, details); | 245 content::WindowedNotificationObserver::Observe(type, source, details); |
244 } | 246 } |
245 } | 247 } |
246 | 248 |
247 // Closes the window embedding the WebContents. The action is separated from | 249 // Closes the window embedding the WebContents. The action is separated from |
248 // the Observe method to make sure the list of observers is not deleted, | 250 // the Observe method to make sure the list of observers is not deleted, |
249 // while some event is already being processed. (That causes ASAN failures.) | 251 // while some event is already being processed. (That causes ASAN failures.) |
250 void CloseEmbedderWebContents() { | 252 void CloseEmbedderWebContents() { |
(...skipping 1222 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1473 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), | 1475 EXPECT_EQ(std::string("https://abcdefghij.chromiumapp.org/callback#test"), |
1474 url); | 1476 url); |
1475 } | 1477 } |
1476 | 1478 |
1477 } // namespace extensions | 1479 } // namespace extensions |
1478 | 1480 |
1479 // Tests the chrome.identity API implemented by custom JS bindings . | 1481 // Tests the chrome.identity API implemented by custom JS bindings . |
1480 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { | 1482 IN_PROC_BROWSER_TEST_F(ExtensionApiTest, ChromeIdentityJsBindings) { |
1481 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; | 1483 ASSERT_TRUE(RunExtensionTest("identity/js_bindings")) << message_; |
1482 } | 1484 } |
OLD | NEW |