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 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
42 Profile::EXPLICIT_ACCESS); | 42 Profile::EXPLICIT_ACCESS); |
43 | 43 |
44 // Schedule a history query for redirects. The response will be sent | 44 // Schedule a history query for redirects. The response will be sent |
45 // asynchronously from the callback the history system uses to notify us | 45 // asynchronously from the callback the history system uses to notify us |
46 // that it's done: OnRedirectQueryComplete. | 46 // that it's done: OnRedirectQueryComplete. |
47 std::vector<GURL> rv; | 47 std::vector<GURL> rv; |
48 history_service->QueryRedirectsFrom( | 48 history_service->QueryRedirectsFrom( |
49 url, &consumer_, | 49 url, &consumer_, |
50 base::Bind(&RedirectTest::OnRedirectQueryComplete, | 50 base::Bind(&RedirectTest::OnRedirectQueryComplete, |
51 base::Unretained(this), &rv)); | 51 base::Unretained(this), &rv)); |
52 ui_test_utils::RunMessageLoop(); | 52 content::RunMessageLoop(); |
53 return rv; | 53 return rv; |
54 } | 54 } |
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) { |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
296 // as a client redirect from the first (/client-redirect?) page. | 296 // as a client redirect from the first (/client-redirect?) page. |
297 for (std::vector<GURL>::iterator it = redirects.begin(); | 297 for (std::vector<GURL>::iterator it = redirects.begin(); |
298 it != redirects.end(); ++it) { | 298 it != redirects.end(); ++it) { |
299 if (final_url.spec() == it->spec()) { | 299 if (final_url.spec() == it->spec()) { |
300 final_navigation_not_redirect = false; | 300 final_navigation_not_redirect = false; |
301 break; | 301 break; |
302 } | 302 } |
303 } | 303 } |
304 EXPECT_TRUE(final_navigation_not_redirect); | 304 EXPECT_TRUE(final_navigation_not_redirect); |
305 } | 305 } |
OLD | NEW |