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

Unified Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 798723004: Fix copying from interstitial pages on OSX. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Address more comments. Created 5 years, 8 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
Index: content/browser/web_contents/web_contents_impl_unittest.cc
diff --git a/content/browser/web_contents/web_contents_impl_unittest.cc b/content/browser/web_contents/web_contents_impl_unittest.cc
index 946cae8331386b9b77d58161533a0de4fb8539ca..6c9f05ea93bf517b8bea381e5763a7abd0323ecf 100644
--- a/content/browser/web_contents/web_contents_impl_unittest.cc
+++ b/content/browser/web_contents/web_contents_impl_unittest.cc
@@ -190,6 +190,10 @@ class TestInterstitialPage : public InterstitialPageImpl {
delegate_ = delegate;
}
+ WebContents* GetWebContents() {
+ return web_contents();
+ }
+
protected:
WebContentsView* CreateWebContentsView() override { return nullptr; }
@@ -2274,6 +2278,31 @@ TEST_F(WebContentsImplTest, NoJSMessageOnInterstitials) {
EXPECT_TRUE(contents()->last_dialog_suppressed_);
}
+// Tests that GetFocusedFrame() does not return NULL for an interstitial.
+// This is is needed for copying from interstitials on OSX: crbug.com/415784
+TEST_F(WebContentsImplTest, CanGetFocusedFrameInInterstitial) {
+ // Show an interstitial.
+ TestInterstitialPage::InterstitialState state =
+ TestInterstitialPage::INVALID;
+ bool deleted = false;
+ GURL interstitial_url("http://interstitial");
+ TestInterstitialPage* interstitial =
+ new TestInterstitialPage(contents(), true, interstitial_url,
+ &state, &deleted);
+ TestInterstitialPageStateGuard state_guard(interstitial);
+ interstitial->Show();
+
+ // Now let's make the interstitial navigation commit.
+ interstitial->TestDidNavigate(1, interstitial_url);
+
+ // Test that we can get GetFocusedFrame().
+ WebContents* webContents = interstitial->GetWebContents();
+ EXPECT_NE(webContents->GetFocusedFrame(), nullptr);
+ EXPECT_NE(webContents->GetFocusedFrame(), webContents->GetMainFrame());
+
+ EXPECT_FALSE(deleted);
+}
+
// Makes sure that if the source passed to CopyStateFromAndPrune has an
// interstitial it isn't copied over to the destination.
TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {

Powered by Google App Engine
This is Rietveld 408576698