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

Side by Side Diff: content/browser/web_contents/web_contents_impl_unittest.cc

Issue 226503002: Move modal dialogs from WebViewClient to WebFrameClient, part 1/3. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: last nits Created 6 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 unified diff | Download patch | Annotate | Revision Log
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/frame_messages.h » ('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 (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 2183 matching lines...) Expand 10 before | Expand all | Expand 10 after
2194 bool deleted = false; 2194 bool deleted = false;
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 contents()->RunJavaScriptMessage(contents()->GetMainFrame(),
2205 contents()->RunJavaScriptMessage(contents()->GetRenderViewHost(),
2206 base::ASCIIToUTF16("This is an informative message"), 2205 base::ASCIIToUTF16("This is an informative message"),
2207 base::ASCIIToUTF16("OK"), 2206 base::ASCIIToUTF16("OK"),
2208 kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message, 2207 kGURL, JAVASCRIPT_MESSAGE_TYPE_ALERT, dummy_message);
2209 &did_suppress_message); 2208 EXPECT_TRUE(contents()->last_dialog_suppressed_);
2210 EXPECT_TRUE(did_suppress_message);
2211 } 2209 }
2212 2210
2213 // Makes sure that if the source passed to CopyStateFromAndPrune has an 2211 // Makes sure that if the source passed to CopyStateFromAndPrune has an
2214 // interstitial it isn't copied over to the destination. 2212 // interstitial it isn't copied over to the destination.
2215 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) { 2213 TEST_F(WebContentsImplTest, CopyStateFromAndPruneSourceInterstitial) {
2216 // Navigate to a page. 2214 // Navigate to a page.
2217 GURL url1("http://www.google.com"); 2215 GURL url1("http://www.google.com");
2218 test_rvh()->SendNavigate(1, url1); 2216 test_rvh()->SendNavigate(1, url1);
2219 EXPECT_EQ(1, controller().GetEntryCount()); 2217 EXPECT_EQ(1, controller().GetEntryCount());
2220 2218
(...skipping 305 matching lines...) Expand 10 before | Expand all | Expand 10 after
2526 WebInputEvent::GesturePinchUpdate, WebGestureEvent::Touchscreen); 2524 WebInputEvent::GesturePinchUpdate, WebGestureEvent::Touchscreen);
2527 event.data.pinchUpdate.scale = kZoomStepValue * 3; 2525 event.data.pinchUpdate.scale = kZoomStepValue * 3;
2528 EXPECT_FALSE(contents()->HandleGestureEvent(event)); 2526 EXPECT_FALSE(contents()->HandleGestureEvent(event));
2529 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount()); 2527 EXPECT_EQ(0, delegate->GetAndResetContentsZoomChangedCallCount());
2530 2528
2531 // Ensure pointers to the delegate aren't kept beyond it's lifetime. 2529 // Ensure pointers to the delegate aren't kept beyond it's lifetime.
2532 contents()->SetDelegate(NULL); 2530 contents()->SetDelegate(NULL);
2533 } 2531 }
2534 2532
2535 } // namespace content 2533 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/web_contents/web_contents_impl.cc ('k') | content/common/frame_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698