blob: 7035596b76cca25de4cbb975409b2058b09d05c8 [file] [log] [blame]
[email protected]93ddb3c2012-04-11 21:44:291// Copyright (c) 2012 The Chromium Authors. All rights reserved.
[email protected]4b6c04e2011-11-07 17:03:572// 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]93ddb3c2012-04-11 21:44:298#include "content/browser/web_contents/web_contents_impl.h"
[email protected]179bccff2012-03-12 18:12:579#include "content/test/net/url_request_abort_on_end_job.h"
[email protected]4b6c04e2011-11-07 17:03:5710
11typedef InProcessBrowserTest WebKitBrowserTest;
12
[email protected]4ca15302012-01-03 05:53:2013using content::WebContents;
14
[email protected]4b6c04e2011-11-07 17:03:5715const 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
24IN_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]4ca15302012-01-03 05:53:2031 WebContents* web_contents = browser()->GetSelectedWebContents();
[email protected]4b6c04e2011-11-07 17:03:5732 // 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]4ca15302012-01-03 05:53:2036 EXPECT_FALSE(web_contents->IsCrashed());
[email protected]4b6c04e2011-11-07 17:03:5737}
38
[email protected]090e47d2011-11-16 17:54:4939// 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.
46const char kXsltBadImportPage[] =
47 "files/webkit/xslt-bad-import.html";
[email protected]72e745b82011-11-28 21:58:2148IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) {
[email protected]090e47d2011-11-16 17:54:4949 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]4ca15302012-01-03 05:53:2055 WebContents* web_contents = browser()->GetSelectedWebContents();
56 EXPECT_FALSE(web_contents->IsCrashed());
[email protected]090e47d2011-11-16 17:54:4957}