| 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 // 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/bind.h" | 10 #include "base/bind.h" |
| (...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 55 | 55 |
| 56 protected: | 56 protected: |
| 57 void OnRedirectQueryComplete( | 57 void OnRedirectQueryComplete( |
| 58 std::vector<GURL>* rv, | 58 std::vector<GURL>* rv, |
| 59 HistoryService::Handle request_handle, | 59 HistoryService::Handle request_handle, |
| 60 GURL from_url, | 60 GURL from_url, |
| 61 bool success, | 61 bool success, |
| 62 history::RedirectList* redirects) { | 62 history::RedirectList* redirects) { |
| 63 for (size_t i = 0; i < redirects->size(); ++i) | 63 for (size_t i = 0; i < redirects->size(); ++i) |
| 64 rv->push_back(redirects->at(i)); | 64 rv->push_back(redirects->at(i)); |
| 65 MessageLoop::current()->PostTask(FROM_HERE, MessageLoop::QuitClosure()); | 65 base::MessageLoop::current()->PostTask(FROM_HERE, |
| 66 base::MessageLoop::QuitClosure()); |
| 66 } | 67 } |
| 67 | 68 |
| 68 // Consumer for asynchronous history queries. | 69 // Consumer for asynchronous history queries. |
| 69 CancelableRequestConsumer consumer_; | 70 CancelableRequestConsumer consumer_; |
| 70 }; | 71 }; |
| 71 | 72 |
| 72 // Tests a single server redirect | 73 // Tests a single server redirect |
| 73 IN_PROC_BROWSER_TEST_F(RedirectTest, Server) { | 74 IN_PROC_BROWSER_TEST_F(RedirectTest, Server) { |
| 74 ASSERT_TRUE(test_server()->Start()); | 75 ASSERT_TRUE(test_server()->Start()); |
| 75 GURL final_url = test_server()->GetURL(std::string()); | 76 GURL final_url = test_server()->GetURL(std::string()); |
| (...skipping 228 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 304 // as a client redirect from the first (/client-redirect?) page. | 305 // as a client redirect from the first (/client-redirect?) page. |
| 305 for (std::vector<GURL>::iterator it = redirects.begin(); | 306 for (std::vector<GURL>::iterator it = redirects.begin(); |
| 306 it != redirects.end(); ++it) { | 307 it != redirects.end(); ++it) { |
| 307 if (final_url.spec() == it->spec()) { | 308 if (final_url.spec() == it->spec()) { |
| 308 final_navigation_not_redirect = false; | 309 final_navigation_not_redirect = false; |
| 309 break; | 310 break; |
| 310 } | 311 } |
| 311 } | 312 } |
| 312 EXPECT_TRUE(final_navigation_not_redirect); | 313 EXPECT_TRUE(final_navigation_not_redirect); |
| 313 } | 314 } |
| OLD | NEW |