Reviewers: Matt Perry,
Message:
Hi Matt,
Could you please review this?
Thanks,
Vaclav
Description:
Split ExtensionWebRequestApiTest.PostData into two
On some debug trybots the original PostData test takes too long and hits the
45s time limit. This splits it into two tests.
BUG=152859
Please review this at https://codereview.chromium.org/11358159/
SVN Base: svn://svn.chromium.org/chrome/trunk/src
Affected files:
M chrome/browser/extensions/api/web_request/web_request_apitest.cc
D chrome/test/data/extensions/api_test/webrequest/test_post.html
M chrome/test/data/extensions/api_test/webrequest/test_post.js
A + chrome/test/data/extensions/api_test/webrequest/test_post1.html
A chrome/test/data/extensions/api_test/webrequest/test_post1.js
A + chrome/test/data/extensions/api_test/webrequest/test_post2.html
A chrome/test/data/extensions/api_test/webrequest/test_post2.js
Index: chrome/test/data/extensions/api_test/webrequest/test_post.html
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post.html
b/chrome/test/data/extensions/api_test/webrequest/test_post.html
deleted file mode 100644
index
a41a0ab1c34612e2d13c939a2dfd464eda6f4e81..000000000000000000000000000000000 0000000
--- a/chrome/test/data/extensions/api_test/webrequest/test_post.html
+++ /dev/null
@@ -1,7 +0,0 @@
-<!--
- * Copyright (c) 2012 The Chromium Authors. All rights reserved. Use of
this
- * source code is governed by a BSD-style license that can be found in the
- * LICENSE file.
--->
-<script src="framework.js"></script>
-<script src="test_post.js"></script>
Index: chrome/browser/extensions/api/web_request/web_request_apitest.cc
diff --git
a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
index
36783634071d2a5795ae6442ed99b2e78c897285..666aa0e6cd874c2472ec2d381ed2c447b 199cfdb
100644
--- a/chrome/browser/extensions/api/web_request/web_request_apitest.cc
+++ b/chrome/browser/extensions/api/web_request/web_request_apitest.cc
@@ -242,9 +242,18 @@ IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
RunPermissionTest("split", false, false, "redirected1", "");
}
-IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, PostData) {
+IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, PostData1) {
// Request body access is only enabled on dev (and canary).
Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV);
- ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post.html")) <<
+ // Test HTML form POST data access with the default and "url" encoding.
+ ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post1.html")) <<
+ message_;
+}
+
+IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, PostData2) {
+ // Request body access is only enabled on dev (and canary).
+ Feature::ScopedCurrentChannel sc(chrome::VersionInfo::CHANNEL_DEV);
+ // Test HTML form POST data access with the multipart and plaintext
encoding.
+ ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_post2.html")) <<
message_;
}
Index: chrome/test/data/extensions/api_test/webrequest/test_post.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post.js
b/chrome/test/data/extensions/api_test/webrequest/test_post.js
index
46268a5cd3ccbb072337553c52d37c1c342b916a..7368b7b6a817f18ab87616750e37e0ac3 c965979
100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_post.js
+++ b/chrome/test/data/extensions/api_test/webrequest/test_post.js
@@ -2,6 +2,8 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
+// Common definitions for test_post?.js.
+
var dirName = "requestBody/";
function sendPost(formFile, parseableForm) {
@@ -128,14 +130,3 @@ function sendPost(formFile, parseableForm) {
navigateAndWait(getURL(dirName + formFile));
}
}
-
-runTests([
- // Navigates to a page with a form and submits it, generating a POST
request.
- // First two result in url-encoded form.
- sendPost('no-enctype.html', true),
- sendPost('urlencoded.html', true),
- // Third results in multipart-encoded form.
- sendPost('multipart.html', true),
- // Fourth results in unparseable form, and thus raw data string.
- sendPost('plaintext.html', false),
-]);
Index: chrome/test/data/extensions/api_test/webrequest/test_post1.html
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post.html
b/chrome/test/data/extensions/api_test/webrequest/test_post1.html
similarity index 86%
copy from chrome/test/data/extensions/api_test/webrequest/test_post.html
copy to chrome/test/data/extensions/api_test/webrequest/test_post1.html
index
a41a0ab1c34612e2d13c939a2dfd464eda6f4e81..ef665b2a838695de64ca4cb66bab37117 335949d
100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_post.html
+++ b/chrome/test/data/extensions/api_test/webrequest/test_post1.html
@@ -5,3 +5,4 @@
-->
<script src="framework.js"></script>
<script src="test_post.js"></script>
+<script src="test_post1.js"></script>
Index: chrome/test/data/extensions/api_test/webrequest/test_post1.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post1.js
b/chrome/test/data/extensions/api_test/webrequest/test_post1.js
new file mode 100644
index
0000000000000000000000000000000000000000..503b56385335c927084f9b66b78519c40 21abc8a
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webrequest/test_post1.js
@@ -0,0 +1,11 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+runTests([
+ // Navigates to a page with a form and submits it, generating a POST
request.
+ // A form in default encoding (which is "urlencoded").
+ sendPost('no-enctype.html', true /*parseableForm*/),
+ // Urlencoded form.
+ sendPost('urlencoded.html', true /*parseableForm*/),
+]);
Index: chrome/test/data/extensions/api_test/webrequest/test_post2.html
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post.html
b/chrome/test/data/extensions/api_test/webrequest/test_post2.html
similarity index 86%
rename from chrome/test/data/extensions/api_test/webrequest/test_post.html
rename to chrome/test/data/extensions/api_test/webrequest/test_post2.html
index
a41a0ab1c34612e2d13c939a2dfd464eda6f4e81..68fc83da491a303cc09f797b560d3f170 f4a9625
100644
--- a/chrome/test/data/extensions/api_test/webrequest/test_post.html
+++ b/chrome/test/data/extensions/api_test/webrequest/test_post2.html
@@ -5,3 +5,4 @@
-->
<script src="framework.js"></script>
<script src="test_post.js"></script>
+<script src="test_post2.js"></script>
Index: chrome/test/data/extensions/api_test/webrequest/test_post2.js
diff --git a/chrome/test/data/extensions/api_test/webrequest/test_post2.js
b/chrome/test/data/extensions/api_test/webrequest/test_post2.js
new file mode 100644
index
0000000000000000000000000000000000000000..0d92dcb5bbdb0f8dcb38f3aabfac05710 34cee7d
--- /dev/null
+++ b/chrome/test/data/extensions/api_test/webrequest/test_post2.js
@@ -0,0 +1,11 @@
+// Copyright (c) 2012 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+runTests([
+ // Navigates to a page with a form and submits it, generating a POST
request.
+ // Multipart-encoded form.
+ sendPost('multipart.html', true /*parseableForm*/),
+ // An unparseable form, thus only raw POST data are extracted.
+ sendPost('plaintext.html', false /*parseableForm*/),
+]);