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 "chrome/browser/ui/browser.h" | 5 #include "chrome/browser/ui/browser.h" |
| 6 #include "chrome/browser/ui/browser_tabstrip.h" |
6 #include "chrome/test/base/in_process_browser_test.h" | 7 #include "chrome/test/base/in_process_browser_test.h" |
7 #include "chrome/test/base/ui_test_utils.h" | 8 #include "chrome/test/base/ui_test_utils.h" |
8 #include "content/browser/web_contents/web_contents_impl.h" | 9 #include "content/browser/web_contents/web_contents_impl.h" |
9 #include "content/test/net/url_request_abort_on_end_job.h" | 10 #include "content/test/net/url_request_abort_on_end_job.h" |
10 | 11 |
11 typedef InProcessBrowserTest WebKitBrowserTest; | 12 typedef InProcessBrowserTest WebKitBrowserTest; |
12 | 13 |
13 using content::WebContents; | 14 using content::WebContents; |
14 | 15 |
15 const char kAsyncScriptThatAbortsOnEndPage[] = | 16 const char kAsyncScriptThatAbortsOnEndPage[] = |
16 "files/webkit/async_script_abort_on_end.html"; | 17 "files/webkit/async_script_abort_on_end.html"; |
17 | 18 |
18 // This is a browser test because it is hard to reproduce reliably in a | 19 // 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 // 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 // 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 // after aborts. This test creates that condition, and it is passed |
22 // if chrome does not crash. | 23 // if chrome does not crash. |
23 | 24 |
24 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { | 25 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { |
25 ASSERT_TRUE(test_server()->Start()); | 26 ASSERT_TRUE(test_server()->Start()); |
26 URLRequestAbortOnEndJob::AddUrlHandler(); | 27 URLRequestAbortOnEndJob::AddUrlHandler(); |
27 GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage); | 28 GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage); |
28 | 29 |
29 ui_test_utils::NavigateToURL(browser(), url); | 30 ui_test_utils::NavigateToURL(browser(), url); |
30 | 31 |
31 WebContents* web_contents = browser()->GetActiveWebContents(); | 32 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
32 // If you are seeing this test fail, please strongly investigate the | 33 // If you are seeing this test fail, please strongly investigate the |
33 // possibility that http://crbug.com/75604 and | 34 // possibility that http://crbug.com/75604 and |
34 // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before | 35 // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before |
35 // marking this as flakey. | 36 // marking this as flakey. |
36 EXPECT_FALSE(web_contents->IsCrashed()); | 37 EXPECT_FALSE(web_contents->IsCrashed()); |
37 } | 38 } |
38 | 39 |
39 // This is a browser test because the DumpRenderTree framework holds | 40 // This is a browser test because the DumpRenderTree framework holds |
40 // onto a Document* reference that blocks this reproduction from | 41 // onto a Document* reference that blocks this reproduction from |
41 // destroying the Document, so it is not a use after free unless | 42 // destroying the Document, so it is not a use after free unless |
42 // you don't have DumpRenderTree loaded. | 43 // you don't have DumpRenderTree loaded. |
43 | 44 |
44 // TODO(gavinp): remove this browser_test if we can get good LayoutTest | 45 // TODO(gavinp): remove this browser_test if we can get good LayoutTest |
45 // coverage of the same issue. | 46 // coverage of the same issue. |
46 const char kXsltBadImportPage[] = | 47 const char kXsltBadImportPage[] = |
47 "files/webkit/xslt-bad-import.html"; | 48 "files/webkit/xslt-bad-import.html"; |
48 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { | 49 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { |
49 ASSERT_TRUE(test_server()->Start()); | 50 ASSERT_TRUE(test_server()->Start()); |
50 URLRequestAbortOnEndJob::AddUrlHandler(); | 51 URLRequestAbortOnEndJob::AddUrlHandler(); |
51 GURL url = test_server()->GetURL(kXsltBadImportPage); | 52 GURL url = test_server()->GetURL(kXsltBadImportPage); |
52 | 53 |
53 ui_test_utils::NavigateToURL(browser(), url); | 54 ui_test_utils::NavigateToURL(browser(), url); |
54 | 55 |
55 WebContents* web_contents = browser()->GetActiveWebContents(); | 56 WebContents* web_contents = chrome::GetActiveWebContents(browser()); |
56 EXPECT_FALSE(web_contents->IsCrashed()); | 57 EXPECT_FALSE(web_contents->IsCrashed()); |
57 } | 58 } |
OLD | NEW |