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 46 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
57 &tracker_); | 57 &tracker_); |
58 content::RunMessageLoop(); | 58 content::RunMessageLoop(); |
59 return rv; | 59 return rv; |
60 } | 60 } |
61 | 61 |
62 protected: | 62 protected: |
63 void OnRedirectQueryComplete(std::vector<GURL>* rv, | 63 void OnRedirectQueryComplete(std::vector<GURL>* rv, |
64 const history::RedirectList* redirects) { | 64 const history::RedirectList* redirects) { |
65 rv->insert(rv->end(), redirects->begin(), redirects->end()); | 65 rv->insert(rv->end(), redirects->begin(), redirects->end()); |
66 base::ThreadTaskRunnerHandle::Get()->PostTask( | 66 base::ThreadTaskRunnerHandle::Get()->PostTask( |
67 FROM_HERE, base::MessageLoop::QuitClosure()); | 67 FROM_HERE, base::MessageLoop::QuitWhenIdleClosure()); |
68 } | 68 } |
69 | 69 |
70 // Tracker for asynchronous history queries. | 70 // Tracker for asynchronous history queries. |
71 base::CancelableTaskTracker tracker_; | 71 base::CancelableTaskTracker tracker_; |
72 }; | 72 }; |
73 | 73 |
74 // Tests a single server redirect | 74 // Tests a single server redirect |
75 IN_PROC_BROWSER_TEST_F(RedirectTest, Server) { | 75 IN_PROC_BROWSER_TEST_F(RedirectTest, Server) { |
76 ASSERT_TRUE(test_server()->Start()); | 76 ASSERT_TRUE(test_server()->Start()); |
77 GURL final_url = test_server()->GetURL(std::string()); | 77 GURL final_url = test_server()->GetURL(std::string()); |
(...skipping 223 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
301 // as a client redirect from the first (/client-redirect?) page. | 301 // as a client redirect from the first (/client-redirect?) page. |
302 for (std::vector<GURL>::iterator it = redirects.begin(); | 302 for (std::vector<GURL>::iterator it = redirects.begin(); |
303 it != redirects.end(); ++it) { | 303 it != redirects.end(); ++it) { |
304 if (final_url.spec() == it->spec()) { | 304 if (final_url.spec() == it->spec()) { |
305 final_navigation_not_redirect = false; | 305 final_navigation_not_redirect = false; |
306 break; | 306 break; |
307 } | 307 } |
308 } | 308 } |
309 EXPECT_TRUE(final_navigation_not_redirect); | 309 EXPECT_TRUE(final_navigation_not_redirect); |
310 } | 310 } |
OLD | NEW |