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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 24436003: Don't leave renderer process frozen when canceling JavaScript dialogs. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Clear callback after calling. Created 7 years, 2 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/command_line.h" 8 #include "base/command_line.h"
9 #include "base/compiler_specific.h" 9 #include "base/compiler_specific.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after
224 public: 224 public:
225 TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) { 225 TestInterstitialPage(WebContents* tab, bool new_navigation, const GURL& url) {
226 interstitial_page_ = InterstitialPage::Create( 226 interstitial_page_ = InterstitialPage::Create(
227 tab, new_navigation, url , this); 227 tab, new_navigation, url , this);
228 interstitial_page_->Show(); 228 interstitial_page_->Show();
229 } 229 }
230 virtual ~TestInterstitialPage() { } 230 virtual ~TestInterstitialPage() { }
231 void Proceed() { 231 void Proceed() {
232 interstitial_page_->Proceed(); 232 interstitial_page_->Proceed();
233 } 233 }
234 void DontProceed() {
235 interstitial_page_->DontProceed();
236 }
234 237
235 virtual std::string GetHTMLContents() OVERRIDE { 238 virtual std::string GetHTMLContents() OVERRIDE {
236 return "<h1>INTERSTITIAL</h1>"; 239 return "<h1>INTERSTITIAL</h1>";
237 } 240 }
238 241
239 private: 242 private:
240 InterstitialPage* interstitial_page_; // Owns us. 243 InterstitialPage* interstitial_page_; // Owns us.
241 }; 244 };
242 245
243 class RenderViewSizeObserver : public content::WebContentsObserver { 246 class RenderViewSizeObserver : public content::WebContentsObserver {
(...skipping 1476 matching lines...) Expand 10 before | Expand all | Expand 10 after
1720 EXPECT_TRUE(contents->ShowingInterstitialPage()); 1723 EXPECT_TRUE(contents->ShowingInterstitialPage());
1721 EXPECT_FALSE(dialog_queue->HasActiveDialog()); 1724 EXPECT_FALSE(dialog_queue->HasActiveDialog());
1722 1725
1723 { 1726 {
1724 scoped_refptr<content::MessageLoopRunner> loop_runner( 1727 scoped_refptr<content::MessageLoopRunner> loop_runner(
1725 new content::MessageLoopRunner); 1728 new content::MessageLoopRunner);
1726 1729
1727 InterstitialObserver observer(contents, 1730 InterstitialObserver observer(contents,
1728 base::Closure(), 1731 base::Closure(),
1729 loop_runner->QuitClosure()); 1732 loop_runner->QuitClosure());
1730 interstitial->Proceed(); 1733 interstitial->DontProceed();
1731 loop_runner->Run(); 1734 loop_runner->Run();
1732 // interstitial is deleted now. 1735 // interstitial is deleted now.
1733 } 1736 }
1737
1738 // Make sure input events still work in the renderer process.
1739 EXPECT_FALSE(contents->GetRenderProcessHost()->IgnoreInputEvents());
1734 } 1740 }
1735 1741
1736 1742
1737 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCloseTab) { 1743 IN_PROC_BROWSER_TEST_F(BrowserTest, InterstitialCloseTab) {
1738 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents(); 1744 WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
1739 1745
1740 { 1746 {
1741 scoped_refptr<content::MessageLoopRunner> loop_runner( 1747 scoped_refptr<content::MessageLoopRunner> loop_runner(
1742 new content::MessageLoopRunner); 1748 new content::MessageLoopRunner);
1743 1749
(...skipping 729 matching lines...) Expand 10 before | Expand all | Expand 10 after
2473 exp_commit_size.Enlarge(wcv_resize_insets.width(), 2479 exp_commit_size.Enlarge(wcv_resize_insets.width(),
2474 wcv_resize_insets.height() + height_inset); 2480 wcv_resize_insets.height() + height_inset);
2475 EXPECT_EQ(exp_commit_size, rwhv_commit_size2); 2481 EXPECT_EQ(exp_commit_size, rwhv_commit_size2);
2476 EXPECT_EQ(exp_commit_size, wcv_commit_size2); 2482 EXPECT_EQ(exp_commit_size, wcv_commit_size2);
2477 // Sizes of RenderWidgetHostView and WebContentsView before and after 2483 // Sizes of RenderWidgetHostView and WebContentsView before and after
2478 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same. 2484 // WebContentsDelegate::DidNavigateMainFramePostCommit should be the same.
2479 EXPECT_EQ(rwhv_commit_size2, 2485 EXPECT_EQ(rwhv_commit_size2,
2480 web_contents->GetRenderWidgetHostView()->GetViewBounds().size()); 2486 web_contents->GetRenderWidgetHostView()->GetViewBounds().size());
2481 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize()); 2487 EXPECT_EQ(wcv_commit_size2, web_contents->GetView()->GetContainerSize());
2482 } 2488 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/app_modal_dialogs/javascript_app_modal_dialog.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698