OLD | NEW |
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2006-2008 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 // Navigates the browser to server and client redirect pages and makes sure | 5 // Navigates the browser to server and client redirect pages and makes sure |
6 // that the correct redirects are reflected in the history database. Errors | 6 // that the correct redirects are reflected in the history database. Errors |
7 // here might indicate that WebKit changed the calls our glue layer gets in | 7 // here might indicate that WebKit changed the calls our glue layer gets in |
8 // the case of redirects. It may also mean problems with the history system. | 8 // the case of redirects. It may also mean problems with the history system. |
9 | 9 |
10 #include "base/file_util.h" | 10 #include "base/file_util.h" |
(...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 // the TestServer. | 104 // the TestServer. |
105 for (int i = 0; i < 10; ++i) { | 105 for (int i = 0; i < 10; ++i) { |
106 PlatformThread::Sleep(sleep_timeout_ms()); | 106 PlatformThread::Sleep(sleep_timeout_ms()); |
107 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); | 107 scoped_refptr<TabProxy> tab_proxy(GetActiveTab()); |
108 ASSERT_TRUE(tab_proxy.get()); | 108 ASSERT_TRUE(tab_proxy.get()); |
109 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); | 109 ASSERT_TRUE(tab_proxy->GetRedirectsFrom(first_url, &redirects)); |
110 if (!redirects.empty()) | 110 if (!redirects.empty()) |
111 break; | 111 break; |
112 } | 112 } |
113 | 113 |
114 EXPECT_EQ(1U, redirects.size()); | 114 ASSERT_EQ(1U, redirects.size()); |
115 EXPECT_EQ(final_url.spec(), redirects[0].spec()); | 115 EXPECT_EQ(final_url.spec(), redirects[0].spec()); |
116 } | 116 } |
117 | 117 |
118 // Tests to make sure a location change when a pending redirect exists isn't | 118 // Tests to make sure a location change when a pending redirect exists isn't |
119 // flagged as a redirect. | 119 // flagged as a redirect. |
120 TEST_F(RedirectTest, ClientCancelled) { | 120 TEST_F(RedirectTest, ClientCancelled) { |
121 FilePath first_path(test_data_directory_); | 121 FilePath first_path(test_data_directory_); |
122 first_path = first_path.AppendASCII("cancelled_redirect_test.html"); | 122 first_path = first_path.AppendASCII("cancelled_redirect_test.html"); |
123 ASSERT_TRUE(file_util::AbsolutePath(&first_path)); | 123 ASSERT_TRUE(file_util::AbsolutePath(&first_path)); |
124 GURL first_url = net::FilePathToFileURL(first_path); | 124 GURL first_url = net::FilePathToFileURL(first_path); |
(...skipping 189 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
314 it != redirects.end(); ++it) { | 314 it != redirects.end(); ++it) { |
315 if (final_url.spec() == it->spec()) { | 315 if (final_url.spec() == it->spec()) { |
316 final_navigation_not_redirect = false; | 316 final_navigation_not_redirect = false; |
317 break; | 317 break; |
318 } | 318 } |
319 } | 319 } |
320 EXPECT_TRUE(final_navigation_not_redirect); | 320 EXPECT_TRUE(final_navigation_not_redirect); |
321 } | 321 } |
322 | 322 |
323 } // namespace | 323 } // namespace |
OLD | NEW |