Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: content/browser/webkit_browsertest.cc

Issue 1411073005: Migrating tests to use EmbeddedTestServer (/content) (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
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 "content/browser/web_contents/web_contents_impl.h" 5 #include "content/browser/web_contents/web_contents_impl.h"
6 #include "content/public/browser/web_contents.h" 6 #include "content/public/browser/web_contents.h"
7 #include "content/public/test/content_browser_test.h" 7 #include "content/public/test/content_browser_test.h"
8 #include "content/public/test/content_browser_test_utils.h" 8 #include "content/public/test/content_browser_test_utils.h"
9 #include "content/shell/browser/shell.h" 9 #include "content/shell/browser/shell.h"
10 #include "content/test/net/url_request_abort_on_end_job.h" 10 #include "content/test/net/url_request_abort_on_end_job.h"
mmenke 2015/11/03 19:12:57 include embedded_test_server.h
svaldez 2015/11/03 19:33:16 Done.
11 11
12 namespace content { 12 namespace content {
13 13
14 typedef ContentBrowserTest WebKitBrowserTest; 14 typedef ContentBrowserTest WebKitBrowserTest;
15 15
16 const char kAsyncScriptThatAbortsOnEndPage[] = 16 const char kAsyncScriptThatAbortsOnEndPage[] =
17 "files/webkit/async_script_abort_on_end.html"; 17 "/webkit/async_script_abort_on_end.html";
18 18
19 // 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
20 // 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
21 // 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
22 // after aborts. This test creates that condition, and it is passed 22 // after aborts. This test creates that condition, and it is passed
23 // if chrome does not crash. 23 // if chrome does not crash.
24 24
25 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) { 25 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, AbortOnEnd) {
26 ASSERT_TRUE(test_server()->Start()); 26 ASSERT_TRUE(embedded_test_server()->Start());
27 URLRequestAbortOnEndJob::AddUrlHandler(); 27 URLRequestAbortOnEndJob::AddUrlHandler();
28 GURL url = test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage); 28 GURL url = embedded_test_server()->GetURL(kAsyncScriptThatAbortsOnEndPage);
29 29
30 NavigateToURL(shell(), url); 30 NavigateToURL(shell(), url);
31 31
32 // If you are seeing this test fail, please strongly investigate the 32 // If you are seeing this test fail, please strongly investigate the
33 // possibility that http://crbug.com/75604 and 33 // possibility that http://crbug.com/75604 and
34 // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before 34 // https://bugs.webkit.org/show_bug.cgi?id=71122 have reverted before
35 // marking this as flakey. 35 // marking this as flakey.
36 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); 36 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
37 } 37 }
38 38
39 // This is a browser test because the test_runner framework holds 39 // This is a browser test because the test_runner framework holds
40 // onto a Document* reference that blocks this reproduction from 40 // onto a Document* reference that blocks this reproduction from
41 // destroying the Document, so it is not a use after free unless 41 // destroying the Document, so it is not a use after free unless
42 // you don't have test_runner loaded. 42 // you don't have test_runner loaded.
43 43
44 // TODO(gavinp): remove this browser_test if we can get good LayoutTest 44 // TODO(gavinp): remove this browser_test if we can get good LayoutTest
45 // coverage of the same issue. 45 // coverage of the same issue.
46 const char kXsltBadImportPage[] = 46 const char kXsltBadImportPage[] = "/webkit/xslt-bad-import.html";
47 "files/webkit/xslt-bad-import.html";
48 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) { 47 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, XsltBadImport) {
49 ASSERT_TRUE(test_server()->Start()); 48 ASSERT_TRUE(embedded_test_server()->Start());
50 URLRequestAbortOnEndJob::AddUrlHandler(); 49 URLRequestAbortOnEndJob::AddUrlHandler();
51 GURL url = test_server()->GetURL(kXsltBadImportPage); 50 GURL url = embedded_test_server()->GetURL(kXsltBadImportPage);
52 51
53 NavigateToURL(shell(), url); 52 NavigateToURL(shell(), url);
54 53
55 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); 54 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
56 } 55 }
57 56
58 // This is a browser test because test_runner has a PrerendererClient 57 // This is a browser test because test_runner has a PrerendererClient
59 // implementation, and the purpose of this test is to ensure that content_shell 58 // 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 59 // does not crash when prerender elements are encountered with no Prererering
61 // implementation supplied to WebKit. 60 // implementation supplied to WebKit.
62 61
63 // TODO(gavinp,jochen): This browser_test depends on there not being a 62 // TODO(gavinp,jochen): This browser_test depends on there not being a
64 // prerendering client and prerendering platform provided by the test_shell. 63 // 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 64 // 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 65 // then add a mechanism to start content_shell without these, or else this
67 // test is not very interesting. 66 // test is not very interesting.
68 const char kPrerenderNoCrashPage[] = 67 const char kPrerenderNoCrashPage[] = "/prerender/prerender-no-crash.html";
69 "files/prerender/prerender-no-crash.html";
70 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, PrerenderNoCrash) { 68 IN_PROC_BROWSER_TEST_F(WebKitBrowserTest, PrerenderNoCrash) {
71 ASSERT_TRUE(test_server()->Start()); 69 ASSERT_TRUE(embedded_test_server()->Start());
72 GURL url = test_server()->GetURL(kPrerenderNoCrashPage); 70 GURL url = embedded_test_server()->GetURL(kPrerenderNoCrashPage);
73 71
74 NavigateToURL(shell(), url); 72 NavigateToURL(shell(), url);
75 73
76 EXPECT_FALSE(shell()->web_contents()->IsCrashed()); 74 EXPECT_FALSE(shell()->web_contents()->IsCrashed());
77 } 75 }
78 76
79 } // namespace content 77 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698