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 #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_path.h" | 9 #include "base/file_path.h" |
10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
(...skipping 348 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
359 | 359 |
360 // Check that the cookie was set, meaning that the onunload handler ran. | 360 // Check that the cookie was set, meaning that the onunload handler ran. |
361 std::string value_result; | 361 std::string value_result; |
362 EXPECT_TRUE(tab->GetCookieByName(url, "onunloadCookie", &value_result)); | 362 EXPECT_TRUE(tab->GetCookieByName(url, "onunloadCookie", &value_result)); |
363 EXPECT_FALSE(value_result.empty()); | 363 EXPECT_FALSE(value_result.empty()); |
364 EXPECT_STREQ("foo", value_result.c_str()); | 364 EXPECT_STREQ("foo", value_result.c_str()); |
365 | 365 |
366 // Check that renderer-initiated navigations still work. In a previous bug, | 366 // Check that renderer-initiated navigations still work. In a previous bug, |
367 // the ResourceDispatcherHost would think that such navigations were | 367 // the ResourceDispatcherHost would think that such navigations were |
368 // cross-site, because we didn't clean up from the previous request. Since | 368 // cross-site, because we didn't clean up from the previous request. Since |
369 // TabContents was in the NORMAL state, it would ignore the attempt to run | 369 // WebContentsImpl was in the NORMAL state, it would ignore the attempt to run |
370 // the onunload handler, and the navigation would fail. We can't test by | 370 // the onunload handler, and the navigation would fail. We can't test by |
371 // redirecting to javascript:window.location='someURL', since javascript: | 371 // redirecting to javascript:window.location='someURL', since javascript: |
372 // URLs are prohibited by policy from interacting with sensitive chrome | 372 // URLs are prohibited by policy from interacting with sensitive chrome |
373 // pages of which the error page is one. Instead, use automation to kick | 373 // pages of which the error page is one. Instead, use automation to kick |
374 // off the navigation, and wait to see that the tab loads. | 374 // off the navigation, and wait to see that the tab loads. |
375 bool success; | 375 bool success; |
376 GURL test_url(test_server.GetURL("files/title2.html")); | 376 GURL test_url(test_server.GetURL("files/title2.html")); |
377 std::string redirect_script = "window.location='" + | 377 std::string redirect_script = "window.location='" + |
378 test_url.possibly_invalid_spec() + "';" + | 378 test_url.possibly_invalid_spec() + "';" + |
379 "window.domAutomationController.send(true);"; | 379 "window.domAutomationController.send(true);"; |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
414 GURL broken_url("chrome://theme"); | 414 GURL broken_url("chrome://theme"); |
415 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); | 415 ASSERT_EQ(AUTOMATION_MSG_NAVIGATION_SUCCESS, tab->NavigateToURL(broken_url)); |
416 | 416 |
417 // Make sure the navigation finishes. | 417 // Make sure the navigation finishes. |
418 std::wstring tab_title; | 418 std::wstring tab_title; |
419 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); | 419 EXPECT_TRUE(tab->GetTabTitle(&tab_title)); |
420 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); | 420 EXPECT_EQ(L"chrome://theme/ is not available", tab_title); |
421 } | 421 } |
422 | 422 |
423 } // namespace | 423 } // namespace |
OLD | NEW |