[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 4b6c04e | 2011-11-07 17:03:57 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | #include "chrome/browser/ui/browser.h" |
| 6 | #include "chrome/test/base/in_process_browser_test.h" |
| 7 | #include "chrome/test/base/ui_test_utils.h" |
[email protected] | 93ddb3c | 2012-04-11 21:44:29 | [diff] [blame] | 8 | #include "content/browser/web_contents/web_contents_impl.h" |
[email protected] | 179bccff | 2012-03-12 18:12:57 | [diff] [blame] | 9 | #include "content/test/net/url_request_abort_on_end_job.h" |
[email protected] | 4b6c04e | 2011-11-07 17:03:57 | [diff] [blame] | 10 | |
| 11 | typedef InProcessBrowserTest WebKitBrowserTest; |
| 12 | |
[email protected] | 4ca1530 | 2012-01-03 05:53:20 | [diff] [blame] | 13 | using content::WebContents; |
| 14 | |
[email protected] | 4b6c04e | 2011-11-07 17:03:57 | [diff] [blame] | 15 | const char kAsyncScriptThatAbortsOnEndPage[] = |
| 16 | "files/webkit/async_script_abort_on_end.html"; |
| 17 | |
| 18 | // This is a browser test because it is hard to reproduce reliably in a |
| 19 | // layout test without races. http://crbug.com/75604 deals with a request |
| 20 | // for an async script which gets data in the response and immediately |
| 21 | // after aborts. This test creates that condition, and it is passed |
| 22 | // if chrome does not crash. |
| 23 | |
| 24 | IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { |
| 25 | ASSERT_TRUE(test_server()->Start()); |
| 26 | URLRequestAbortOnEndJob::AddUrlHandler(); |
| 27 | GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage); |
| 28 | |
| 29 | ui_test_utils::NavigateToURL(browser(), url); |
| 30 | |
[email protected] | 4ca1530 | 2012-01-03 05:53:20 | [diff] [blame] | 31 | WebContents* web_contents = browser()->GetSelectedWebContents(); |
[email protected] | 4b6c04e | 2011-11-07 17:03:57 | [diff] [blame] | 32 | // If you are seeing this test fail, please strongly investigate the |
| 33 | // possibility that http://crbug.com/75604 and |
| 34 | // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before |
| 35 | // marking this as flakey. |
[email protected] | 4ca1530 | 2012-01-03 05:53:20 | [diff] [blame] | 36 | EXPECT_FALSE(web_contents->IsCrashed()); |
[email protected] | 4b6c04e | 2011-11-07 17:03:57 | [diff] [blame] | 37 | } |
| 38 | |
[email protected] | 090e47d | 2011-11-16 17:54:49 | [diff] [blame] | 39 | // This is a browser test because the DumpRenderTree framework holds |
| 40 | // onto a Document* reference that blocks this reproduction from |
| 41 | // destroying the Document, so it is not a use after free unless |
| 42 | // you don't have DumpRenderTree loaded. |
| 43 | |
| 44 | // TODO(gavinp): remove this browser_test if we can get good LayoutTest |
| 45 | // coverage of the same issue. |
| 46 | const char kXsltBadImportPage[] = |
| 47 | "files/webkit/xslt-bad-import.html"; |
[email protected] | 72e745b8 | 2011-11-28 21:58:21 | [diff] [blame] | 48 | IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { |
[email protected] | 090e47d | 2011-11-16 17:54:49 | [diff] [blame] | 49 | ASSERT_TRUE(test_server()->Start()); |
| 50 | URLRequestAbortOnEndJob::AddUrlHandler(); |
| 51 | GURL url = test_server()->GetURL(kXsltBadImportPage); |
| 52 | |
| 53 | ui_test_utils::NavigateToURL(browser(), url); |
| 54 | |
[email protected] | 4ca1530 | 2012-01-03 05:53:20 | [diff] [blame] | 55 | WebContents* web_contents = browser()->GetSelectedWebContents(); |
| 56 | EXPECT_FALSE(web_contents->IsCrashed()); |
[email protected] | 090e47d | 2011-11-16 17:54:49 | [diff] [blame] | 57 | } |