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

Side by Side Diff: chrome/browser/apps/guest_view/web_view_browsertest.cc

Issue 2546523004: <webview> Fix crash when closing chrome://chrome-signin (Closed)
Patch Set: Created 4 years 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
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 <queue> 5 #include <queue>
6 #include <set> 6 #include <set>
7 #include <utility> 7 #include <utility>
8 8
9 #include "base/callback_helpers.h" 9 #include "base/callback_helpers.h"
10 #include "base/files/file_util.h" 10 #include "base/files/file_util.h"
(...skipping 21 matching lines...) Expand all
32 #include "chrome/browser/download/download_service_factory.h" 32 #include "chrome/browser/download/download_service_factory.h"
33 #include "chrome/browser/lifetime/application_lifetime.h" 33 #include "chrome/browser/lifetime/application_lifetime.h"
34 #include "chrome/browser/pdf/pdf_extension_test_util.h" 34 #include "chrome/browser/pdf/pdf_extension_test_util.h"
35 #include "chrome/browser/prerender/prerender_link_manager.h" 35 #include "chrome/browser/prerender/prerender_link_manager.h"
36 #include "chrome/browser/prerender/prerender_link_manager_factory.h" 36 #include "chrome/browser/prerender/prerender_link_manager_factory.h"
37 #include "chrome/browser/profiles/profile.h" 37 #include "chrome/browser/profiles/profile.h"
38 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h" 38 #include "chrome/browser/renderer_context_menu/render_view_context_menu.h"
39 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h" 39 #include "chrome/browser/renderer_context_menu/render_view_context_menu_test_uti l.h"
40 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" 40 #include "chrome/browser/task_manager/task_manager_browsertest_util.h"
41 #include "chrome/browser/ui/browser.h" 41 #include "chrome/browser/ui/browser.h"
42 #include "chrome/browser/ui/browser_commands.h"
42 #include "chrome/browser/ui/browser_dialogs.h" 43 #include "chrome/browser/ui/browser_dialogs.h"
43 #include "chrome/browser/ui/tabs/tab_strip_model.h" 44 #include "chrome/browser/ui/tabs/tab_strip_model.h"
44 #include "chrome/test/base/ui_test_utils.h" 45 #include "chrome/test/base/ui_test_utils.h"
45 #include "components/content_settings/core/browser/host_content_settings_map.h" 46 #include "components/content_settings/core/browser/host_content_settings_map.h"
46 #include "components/guest_view/browser/guest_view_manager.h" 47 #include "components/guest_view/browser/guest_view_manager.h"
47 #include "components/guest_view/browser/guest_view_manager_delegate.h" 48 #include "components/guest_view/browser/guest_view_manager_delegate.h"
48 #include "components/guest_view/browser/guest_view_manager_factory.h" 49 #include "components/guest_view/browser/guest_view_manager_factory.h"
49 #include "components/guest_view/browser/test_guest_view_manager.h" 50 #include "components/guest_view/browser/test_guest_view_manager.h"
50 #include "content/public/browser/ax_event_notification_details.h" 51 #include "content/public/browser/ax_event_notification_details.h"
51 #include "content/public/browser/gpu_data_manager.h" 52 #include "content/public/browser/gpu_data_manager.h"
(...skipping 3800 matching lines...) Expand 10 before | Expand all | Expand 10 after
3852 gfx::Point embedder_origin = 3853 gfx::Point embedder_origin =
3853 GetEmbedderWebContents()->GetContainerBounds().origin(); 3854 GetEmbedderWebContents()->GetContainerBounds().origin();
3854 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y()); 3855 guest_rect.Offset(-embedder_origin.x(), -embedder_origin.y());
3855 3856
3856 // Generate and send synthetic touch event. 3857 // Generate and send synthetic touch event.
3857 content::SimulateTouchPressAt(GetEmbedderWebContents(), 3858 content::SimulateTouchPressAt(GetEmbedderWebContents(),
3858 guest_rect.CenterPoint()); 3859 guest_rect.CenterPoint());
3859 EXPECT_TRUE(aura_webview->HasFocus()); 3860 EXPECT_TRUE(aura_webview->HasFocus());
3860 } 3861 }
3861 #endif 3862 #endif
3863
3864 // This runs the chrome://chrome-signin page which includes an OOPIF-<webview>
3865 // of accounts.google.com.
3866 class ChromeSignInWebViewTest : public WebViewTestBase {
3867 public:
3868 ChromeSignInWebViewTest() {}
3869 ~ChromeSignInWebViewTest() override {}
3870
3871 protected:
3872 void SetUpCommandLine(base::CommandLine* command_line) override {
3873 command_line->AppendSwitchASCII(
3874 switches::kEnableFeatures,
3875 ::features::kGuestViewCrossProcessFrames.name);
3876 }
3877
3878 void WaitForWebViewInDom() {
3879 auto* web_contents = browser()->tab_strip_model()->GetActiveWebContents();
3880 auto* script =
3881 "var count = 10;"
3882 "var interval;"
3883 "interval = setInterval(function(){"
3884 " if (document.getElementsByTagName('webview').length) {"
3885 " document.title = 'success';"
3886 " console.log('FOUND webview');"
3887 " clearInterval(interval);"
3888 " } else if (count == 0) {"
3889 " document.title = 'error';"
3890 " clearInterval(interval);"
3891 " } else {"
3892 " count -= 1;"
3893 " }"
3894 "}, 1000);";
3895 ExecuteScriptWaitForTitle(web_contents, script, "success");
3896 }
3897 };
3898
3899 #if (defined(OS_LINUX) && !defined(OS_CHROMEOS)) || defined(OS_MACOSX) || \
3900 defined(OS_WIN)
3901 // This verifies the fix for http://crbug.com/667708.
3902 IN_PROC_BROWSER_TEST_F(ChromeSignInWebViewTest,
3903 ClosingChromeSignInShouldNotCrash) {
3904 GURL signin_url{"chrome://chrome-signin"};
3905
3906 AddTabAtIndex(0, signin_url, ui::PAGE_TRANSITION_TYPED);
3907 AddTabAtIndex(1, signin_url, ui::PAGE_TRANSITION_TYPED);
3908 WaitForWebViewInDom();
3909
3910 chrome::CloseTab(browser());
3911 }
3912 #endif
OLDNEW
« no previous file with comments | « no previous file | content/browser/web_contents/web_contents_impl.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698