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/strings/utf_string_conversions.h" | 6 #include "base/strings/utf_string_conversions.h" |
7 #include "content/browser/frame_host/cross_site_transferring_request.h" | 7 #include "content/browser/frame_host/cross_site_transferring_request.h" |
8 #include "content/browser/frame_host/interstitial_page_impl.h" | 8 #include "content/browser/frame_host/interstitial_page_impl.h" |
9 #include "content/browser/frame_host/navigation_entry_impl.h" | 9 #include "content/browser/frame_host/navigation_entry_impl.h" |
10 #include "content/browser/renderer_host/render_view_host_impl.h" | 10 #include "content/browser/renderer_host/render_view_host_impl.h" |
(...skipping 2184 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2195 TestInterstitialPage* interstitial = | 2195 TestInterstitialPage* interstitial = |
2196 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); | 2196 new TestInterstitialPage(contents(), true, kGURL, &state, &deleted); |
2197 TestInterstitialPageStateGuard state_guard(interstitial); | 2197 TestInterstitialPageStateGuard state_guard(interstitial); |
2198 interstitial->Show(); | 2198 interstitial->Show(); |
2199 interstitial->TestDidNavigate(1, kGURL); | 2199 interstitial->TestDidNavigate(1, kGURL); |
2200 | 2200 |
2201 // While the interstitial is showing, let's simulate the hidden page | 2201 // While the interstitial is showing, let's simulate the hidden page |
2202 // attempting to show a JS message. | 2202 // attempting to show a JS message. |
2203 IPC::Message* dummy_message = new IPC::Message; | 2203 IPC::Message* dummy_message = new IPC::Message; |
2204 bool did_suppress_message = false; | 2204 bool did_suppress_message = false; |
2205 contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(), | 2205 contents()->RunJavaScriptMessage(contents()->GetMainFrame(), |
2206 base::ASCIIToUTF16("This is an informative message"), | 2206 base::ASCIIToUTF16("This is an informative message"), |
2207 base::ASCIIToUTF16("OK"), | 2207 base::ASCIIToUTF16("OK"), |
2208 kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, | 2208 kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, |
2209 &did_suppress_message); | 2209 &did_suppress_message); |
2210 EXPECT_TRUE(did_suppress_message); | 2210 EXPECT_TRUE(did_suppress_message); |
2211 } | 2211 } |
2212 | 2212 |
2213 // Makes sure that if the source passed to CopyStateFromAndPrune has an | 2213 // Makes sure that if the source passed to CopyStateFromAndPrune has an |
2214 // interstitial it isn't copied over to the destination. | 2214 // interstitial it isn't copied over to the destination. |
2215 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { | 2215 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { |
(...skipping 310 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
2526 WebInputEvent::GesturePinchUpdate, WebGestureEvent::Touchscreen); | 2526 WebInputEvent::GesturePinchUpdate, WebGestureEvent::Touchscreen); |
2527 event.data.pinchUpdate.scale = kZoomStepValue * 3; | 2527 event.data.pinchUpdate.scale = kZoomStepValue * 3; |
2528 EXPECT_FALSE(contents()->HandleGestureEvent(event)); | 2528 EXPECT_FALSE(contents()->HandleGestureEvent(event)); |
2529 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); | 2529 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); |
2530 | 2530 |
2531 // Ensure pointers to the delegate aren't kept beyond it's lifetime. | 2531 // Ensure pointers to the delegate aren't kept beyond it's lifetime. |
2532 contents()->SetDelegate(NULL); | 2532 contents()->SetDelegate(NULL); |
2533 } | 2533 } |
2534 | 2534 |
2535 } // namespace content | 2535 } // namespace content |
OLD | NEW |