OLD | NEW |
---|---|
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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/basictypes.h" | 5 #include "base/basictypes.h" |
6 #include "base/command_line.h" | 6 #include "base/command_line.h" |
7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 8 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/public/browser/web_contents.h" | 9 #include "content/public/browser/web_contents.h" |
10 #include "content/public/common/content_switches.h" | 10 #include "content/public/common/content_switches.h" |
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
152 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); | 152 EXPECT_TRUE(WaitForLoadStop(shell()->web_contents())); |
153 EXPECT_EQ(url, observer.last_navigation_url()); | 153 EXPECT_EQ(url, observer.last_navigation_url()); |
154 EXPECT_TRUE(observer.last_navigation_succeeded()); | 154 EXPECT_TRUE(observer.last_navigation_succeeded()); |
155 } | 155 } |
156 | 156 |
157 // The RenderFrameHost should not have changed. | 157 // The RenderFrameHost should not have changed. |
158 EXPECT_EQ(initial_rfh, static_cast<WebContentsImpl*>(shell()->web_contents()) | 158 EXPECT_EQ(initial_rfh, static_cast<WebContentsImpl*>(shell()->web_contents()) |
159 ->GetFrameTree()->root()->current_frame_host()); | 159 ->GetFrameTree()->root()->current_frame_host()); |
160 } | 160 } |
161 | 161 |
162 // Ensure that browser side navigation handles navigation failures. | |
163 IN_PROC_BROWSER_TEST_F(BrowserSideNavigationBrowserTest, FailedNavigation) { | |
164 // Perform a navigation with no live renderer. | |
165 { | |
166 TestNavigationObserver observer(shell()->web_contents()); | |
167 GURL url(embedded_test_server()->GetURL("/title1.html")); | |
168 NavigateToURL(shell(), url); | |
169 EXPECT_EQ(url, observer.last_navigation_url()); | |
170 EXPECT_TRUE(observer.last_navigation_succeeded()); | |
171 } | |
172 | |
173 // Now navigate to an unreachable url. | |
174 { | |
175 TestNavigationObserver observer(shell()->web_contents()); | |
176 GURL url("http://127.0.0.1:4"); | |
clamy
2015/04/10 14:04:49
The url was chosen to get a network error (otherwi
Charlie Reis
2015/04/10 22:54:44
I think we have better ways to do this. Please se
clamy
2015/04/14 11:56:25
Done.
| |
177 NavigateToURL(shell(), url); | |
178 EXPECT_EQ(url, observer.last_navigation_url()); | |
179 EXPECT_EQ(1, observer.navigations_failed()); | |
180 // TODO(clamy): when start/stop loading events are properly reported, update | |
181 // this test to check for the status of the last navigation. | |
182 } | |
183 } | |
184 | |
162 } // namespace content | 185 } // namespace content |
OLD | NEW |