| 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 #include <sstream> | 5 #include <sstream> |
| 6 #include <string> | 6 #include <string> |
| 7 | 7 |
| 8 #include "base/command_line.h" | 8 #include "base/command_line.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 213 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 224 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); | 224 scoped_ptr<BrowserProxy> browser_proxy(automation()->GetBrowserWindow(0)); |
| 225 EXPECT_TRUE(browser_proxy.get()); | 225 EXPECT_TRUE(browser_proxy.get()); |
| 226 scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab()); | 226 scoped_ptr<TabProxy> tab(browser_proxy->GetActiveTab()); |
| 227 | 227 |
| 228 // Start with an HTTP page. | 228 // Start with an HTTP page. |
| 229 CheckTitleTest(L"content-sniffer-test0.html", | 229 CheckTitleTest(L"content-sniffer-test0.html", |
| 230 L"Content Sniffer Test 0"); | 230 L"Content Sniffer Test 0"); |
| 231 | 231 |
| 232 // Now load a file:// page, which does not use the BufferedEventHandler. | 232 // Now load a file:// page, which does not use the BufferedEventHandler. |
| 233 // Make sure that the page loads and displays a title, and doesn't get stuck. | 233 // Make sure that the page loads and displays a title, and doesn't get stuck. |
| 234 std::wstring test_file = test_data_directory_; | 234 FilePath test_file(FilePath::FromWStringHack(test_data_directory_)); |
| 235 file_util::AppendToPath(&test_file, L"title2.html"); | 235 test_file = test_file.AppendASCII("title2.html"); |
| 236 bool timed_out = false; | 236 bool timed_out = false; |
| 237 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file), | 237 tab->NavigateToURLWithTimeout(net::FilePathToFileURL(test_file), |
| 238 action_max_timeout_ms(), | 238 action_max_timeout_ms(), |
| 239 &timed_out); | 239 &timed_out); |
| 240 EXPECT_FALSE(timed_out); | 240 EXPECT_FALSE(timed_out); |
| 241 EXPECT_EQ(L"Title Of Awesomeness", GetActiveTabTitle()); | 241 EXPECT_EQ(L"Title Of Awesomeness", GetActiveTabTitle()); |
| 242 } | 242 } |
| 243 | 243 |
| 244 // Tests that a cross-site navigation to an error page (resulting in the link | 244 // Tests that a cross-site navigation to an error page (resulting in the link |
| 245 // doctor page) still runs the onunload handler and can support navigations | 245 // doctor page) still runs the onunload handler and can support navigations |
| (...skipping 43 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 289 // the onunload handler, and the navigation would fail. | 289 // the onunload handler, and the navigation would fail. |
| 290 // (Test by redirecting to javascript:window.location='someURL'.) | 290 // (Test by redirecting to javascript:window.location='someURL'.) |
| 291 GURL test_url(server->TestServerPageW(L"files/title2.html")); | 291 GURL test_url(server->TestServerPageW(L"files/title2.html")); |
| 292 std::wstring redirect_url = L"javascript:window.location='" + | 292 std::wstring redirect_url = L"javascript:window.location='" + |
| 293 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; | 293 ASCIIToWide(test_url.possibly_invalid_spec()) + L"'"; |
| 294 tab->NavigateToURLAsync(GURL(redirect_url)); | 294 tab->NavigateToURLAsync(GURL(redirect_url)); |
| 295 Sleep(sleep_timeout_ms()); // Wait for JavaScript redirect to happen. | 295 Sleep(sleep_timeout_ms()); // Wait for JavaScript redirect to happen. |
| 296 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 296 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
| 297 EXPECT_EQ(L"Title Of Awesomeness", tab_title); | 297 EXPECT_EQ(L"Title Of Awesomeness", tab_title); |
| 298 } | 298 } |
| OLD | NEW |