Updating trunk VERSION from 2139.0 to 2140.0
[chromium-blink-merge.git] / content / browser / webkit_browsertest.cc
blob4202eecb3ef2944af6f307df2dc24468becf9af8
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
3 // found in the LICENSE file.
5 #include "content/browser/web_contents/web_contents_impl.h"
6 #include "content/public/browser/web_contents.h"
7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/shell/browser/shell.h"
10 #include "content/test/net/url_request_abort_on_end_job.h"
12 namespace content {
14 typedef ContentBrowserTest WebKitBrowserTest;
16 const char kAsyncScriptThatAbortsOnEndPage[] =
17 "files/webkit/async_script_abort_on_end.html";
19 // This is a browser test because it is hard to reproduce reliably in a
20 // layout test without races. http://crbug.com/75604 deals with a request
21 // for an async script which gets data in the response and immediately
22 // after aborts. This test creates that condition, and it is passed
23 // if chrome does not crash.
25 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) {
26 ASSERT_TRUE(test_server()->Start());
27 URLRequestAbortOnEndJob::AddUrlHandler();
28 GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage);
30 NavigateToURL(shell(), url);
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.
36 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
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.
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";
48 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) {
49 ASSERT_TRUE(test_server()->Start());
50 URLRequestAbortOnEndJob::AddUrlHandler();
51 GURL url = test_server()->GetURL(kXsltBadImportPage);
53 NavigateToURL(shell(), url);
55 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
58 // This is a browser test because DumpRenderTree has a PrerendererClient
59 // implementation, and the purpose of this test is to ensure that content_shell
60 // does not crash when prerender elements are encountered with no Prererering
61 // implementation supplied to WebKit.
63 // TODO(gavinp,jochen): This browser_test depends on there not being a
64 // prerendering client and prerendering platform provided by the test_shell.
65 // But both will exist when we use content_shell to run layout tests. We must
66 // then add a mechanism to start content_shell without these, or else this
67 // test is not very interesting.
68 const char kPrerenderNoCrashPage[] =
69 "files/prerender/prerender-no-crash.html";
70 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, PrerenderNoCrash) {
71 ASSERT_TRUE(test_server()->Start());
72 GURL url = test_server()->GetURL(kPrerenderNoCrashPage);
74 NavigateToURL(shell(), url);
76 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
79 } // namespace content