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

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

Issue 1530183004: Revert 3 CLs for shouldOverrideUrlLoading implementation. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebase (simple conflict in AwContentsClientShouldOverrideUrlLoadingTest). Created 4 years, 11 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
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/macros.h" 5 #include "base/macros.h"
6 #include "base/strings/utf_string_conversions.h" 6 #include "base/strings/utf_string_conversions.h"
7 #include "base/values.h" 7 #include "base/values.h"
8 #include "build/build_config.h" 8 #include "build/build_config.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_widget_host_impl.h" 10 #include "content/browser/renderer_host/render_widget_host_impl.h"
(...skipping 171 matching lines...) Expand 10 before | Expand all | Expand 10 after
182 int loadingStateChangedCount() const { return loadingStateChangedCount_; } 182 int loadingStateChangedCount() const { return loadingStateChangedCount_; }
183 int loadingStateToDifferentDocumentCount() const { 183 int loadingStateToDifferentDocumentCount() const {
184 return loadingStateToDifferentDocumentCount_; 184 return loadingStateToDifferentDocumentCount_;
185 } 185 }
186 186
187 private: 187 private:
188 int loadingStateChangedCount_; 188 int loadingStateChangedCount_;
189 int loadingStateToDifferentDocumentCount_; 189 int loadingStateToDifferentDocumentCount_;
190 }; 190 };
191 191
192 // See: http://crbug.com/298193
193 #if defined(OS_WIN) || defined(OS_LINUX)
194 #define MAYBE_DidStopLoadingDetails DISABLED_DidStopLoadingDetails
195 #else
196 #define MAYBE_DidStopLoadingDetails DidStopLoadingDetails
197 #endif
198
199 // Test that DidStopLoading includes the correct URL in the details.
200 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
201 MAYBE_DidStopLoadingDetails) {
202 ASSERT_TRUE(embedded_test_server()->Start());
203
204 LoadStopNotificationObserver load_observer(
205 &shell()->web_contents()->GetController());
206 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
207 load_observer.Wait();
208
209 EXPECT_EQ("/title1.html", load_observer.url_.path());
210 EXPECT_EQ(0, load_observer.session_index_);
211 EXPECT_EQ(&shell()->web_contents()->GetController(),
212 load_observer.controller_);
213 }
214
215 // See: http://crbug.com/298193
216 #if defined(OS_WIN) || defined(OS_LINUX)
217 #define MAYBE_DidStopLoadingDetailsWithPending \
218 DISABLED_DidStopLoadingDetailsWithPending
219 #else
220 #define MAYBE_DidStopLoadingDetailsWithPending DidStopLoadingDetailsWithPending
221 #endif
222
223 // Test that DidStopLoading includes the correct URL in the details when a
224 // pending entry is present.
225 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
226 MAYBE_DidStopLoadingDetailsWithPending) {
227 ASSERT_TRUE(embedded_test_server()->Start());
228 GURL url("data:text/html,<div>test</div>");
229
230 // Listen for the first load to stop.
231 LoadStopNotificationObserver load_observer(
232 &shell()->web_contents()->GetController());
233 // Start a new pending navigation as soon as the first load commits.
234 // We will hear a DidStopLoading from the first load as the new load
235 // is started.
236 NavigateOnCommitObserver commit_observer(
237 shell(), embedded_test_server()->GetURL("/title2.html"));
238 NavigateToURL(shell(), url);
239 load_observer.Wait();
240
241 EXPECT_EQ(url, load_observer.url_);
242 EXPECT_EQ(0, load_observer.session_index_);
243 EXPECT_EQ(&shell()->web_contents()->GetController(),
244 load_observer.controller_);
245 }
192 // Test that a renderer-initiated navigation to an invalid URL does not leave 246 // Test that a renderer-initiated navigation to an invalid URL does not leave
193 // around a pending entry that could be used in a URL spoof. We test this in 247 // around a pending entry that could be used in a URL spoof. We test this in
194 // a browser test because our unit test framework incorrectly calls 248 // a browser test because our unit test framework incorrectly calls
195 // DidStartProvisionalLoadForFrame for in-page navigations. 249 // DidStartProvisionalLoadForFrame for in-page navigations.
196 // See http://crbug.com/280512. 250 // See http://crbug.com/280512.
197 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest, 251 IN_PROC_BROWSER_TEST_F(WebContentsImplBrowserTest,
198 ClearNonVisiblePendingOnFail) { 252 ClearNonVisiblePendingOnFail) {
199 ASSERT_TRUE(embedded_test_server()->Start()); 253 ASSERT_TRUE(embedded_test_server()->Start());
200 254
201 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html")); 255 NavigateToURL(shell(), embedded_test_server()->GetURL("/title1.html"));
(...skipping 556 matching lines...) Expand 10 before | Expand all | Expand 10 after
758 Shell* new_shell = new_shell_observer.GetShell(); 812 Shell* new_shell = new_shell_observer.GetShell();
759 WaitForLoadStop(new_shell->web_contents()); 813 WaitForLoadStop(new_shell->web_contents());
760 814
761 EXPECT_EQ("foo", 815 EXPECT_EQ("foo",
762 static_cast<WebContentsImpl*>(new_shell->web_contents()) 816 static_cast<WebContentsImpl*>(new_shell->web_contents())
763 ->GetFrameTree()->root()->frame_name()); 817 ->GetFrameTree()->root()->frame_name());
764 } 818 }
765 } 819 }
766 820
767 } // namespace content 821 } // namespace content
OLDNEW
« no previous file with comments | « components/navigation_interception/intercept_navigation_throttle.cc ('k') | content/public/renderer/content_renderer_client.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698