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/logging.h" | 5 #include "base/logging.h" |
6 #include "base/utf_string_conversions.h" | 6 #include "base/utf_string_conversions.h" |
7 #include "content/browser/mock_content_browser_client.h" | 7 #include "content/browser/mock_content_browser_client.h" |
8 #include "content/browser/renderer_host/render_view_host_impl.h" | 8 #include "content/browser/renderer_host/render_view_host_impl.h" |
9 #include "content/browser/renderer_host/test_render_view_host.h" | 9 #include "content/browser/renderer_host/test_render_view_host.h" |
10 #include "content/browser/site_instance_impl.h" | 10 #include "content/browser/site_instance_impl.h" |
(...skipping 1817 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1828 TestInterstitialPageStateGuard state_guard(interstitial); | 1828 TestInterstitialPageStateGuard state_guard(interstitial); |
1829 interstitial->Show(); | 1829 interstitial->Show(); |
1830 interstitial->TestDidNavigate(1, kGURL); | 1830 interstitial->TestDidNavigate(1, kGURL); |
1831 | 1831 |
1832 // While the interstitial is showing, let's simulate the hidden page | 1832 // While the interstitial is showing, let's simulate the hidden page |
1833 // attempting to show a JS message. | 1833 // attempting to show a JS message. |
1834 IPC::Message* dummy_message = new IPC::Message; | 1834 IPC::Message* dummy_message = new IPC::Message; |
1835 bool did_suppress_message = false; | 1835 bool did_suppress_message = false; |
1836 contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(), | 1836 contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(), |
1837 ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), | 1837 ASCIIToUTF16("This is an informative message"), ASCIIToUTF16("OK"), |
1838 kGURL, ui::JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, | 1838 kGURL, content::JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, |
1839 &did_suppress_message); | 1839 &did_suppress_message); |
1840 EXPECT_TRUE(did_suppress_message); | 1840 EXPECT_TRUE(did_suppress_message); |
1841 } | 1841 } |
1842 | 1842 |
1843 // Makes sure that if the source passed to CopyStateFromAndPrune has an | 1843 // Makes sure that if the source passed to CopyStateFromAndPrune has an |
1844 // interstitial it isn't copied over to the destination. | 1844 // interstitial it isn't copied over to the destination. |
1845 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { | 1845 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { |
1846 // Navigate to a page. | 1846 // Navigate to a page. |
1847 GURL url1("http://www.google.com"); | 1847 GURL url1("http://www.google.com"); |
1848 test_rvh()->SendNavigate(1, url1); | 1848 test_rvh()->SendNavigate(1, url1); |
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1933 // It should have a transient entry. | 1933 // It should have a transient entry. |
1934 EXPECT_TRUE(other_controller.GetTransientEntry()); | 1934 EXPECT_TRUE(other_controller.GetTransientEntry()); |
1935 | 1935 |
1936 // And the interstitial should be showing. | 1936 // And the interstitial should be showing. |
1937 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); | 1937 EXPECT_TRUE(other_contents->ShowingInterstitialPage()); |
1938 | 1938 |
1939 // And the interstitial should do a reload on don't proceed. | 1939 // And the interstitial should do a reload on don't proceed. |
1940 EXPECT_TRUE(static_cast<InterstitialPageImpl*>( | 1940 EXPECT_TRUE(static_cast<InterstitialPageImpl*>( |
1941 other_contents->GetInterstitialPage())->reload_on_dont_proceed()); | 1941 other_contents->GetInterstitialPage())->reload_on_dont_proceed()); |
1942 } | 1942 } |
OLD | NEW |