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

Side by Side Diff: chrome/browser/extensions/api/web_request/web_request_apitest.cc

Issue 2003593002: Add tests for webRequest events and frame unload (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 7 months 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 "base/command_line.h" 5 #include "base/command_line.h"
6 #include "base/macros.h" 6 #include "base/macros.h"
7 #include "base/memory/ptr_util.h" 7 #include "base/memory/ptr_util.h"
8 #include "base/strings/stringprintf.h" 8 #include "base/strings/stringprintf.h"
9 #include "build/build_config.h" 9 #include "build/build_config.h"
10 #include "chrome/browser/chrome_notification_types.h" 10 #include "chrome/browser/chrome_notification_types.h"
(...skipping 141 matching lines...) Expand 10 before | Expand all | Expand 10 after
152 ASSERT_TRUE(StartEmbeddedTestServer()); 152 ASSERT_TRUE(StartEmbeddedTestServer());
153 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_complex.html")) << 153 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_complex.html")) <<
154 message_; 154 message_;
155 } 155 }
156 156
157 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestTypes) { 157 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, WebRequestTypes) {
158 ASSERT_TRUE(StartEmbeddedTestServer()); 158 ASSERT_TRUE(StartEmbeddedTestServer());
159 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_types.html")) << message_; 159 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_types.html")) << message_;
160 } 160 }
161 161
162 // Tests what happens when a frame/tab is removed while a response is being
163 // received.
battre 2016/05/23 11:17:07 Rephrase this to "Test that ... happens"?
robwu 2016/05/23 11:51:03 Done.
164 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
165 WebRequestUnloadAfterRequest) {
166 ASSERT_TRUE(StartEmbeddedTestServer());
167 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?1")) <<
168 message_;
169 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?2")) <<
170 message_;
171 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?3")) <<
172 message_;
173 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?4")) <<
174 message_;
175 }
176
177 // Tests what happens when a frame/tab is removed immediately after issuing a
178 // request.
battre 2016/05/23 11:17:07 Ditto.
robwu 2016/05/23 11:51:03 Done.
179 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
180 WebRequestUnloadImmediately) {
181 ASSERT_TRUE(StartEmbeddedTestServer());
182 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?5")) <<
183 message_;
184 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_unload.html?6")) <<
185 message_;
186 }
187
162 // Flaky (sometimes crash): http://crbug.com/140976 188 // Flaky (sometimes crash): http://crbug.com/140976
163 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest, 189 IN_PROC_BROWSER_TEST_F(ExtensionWebRequestApiTest,
164 DISABLED_WebRequestAuthRequired) { 190 DISABLED_WebRequestAuthRequired) {
165 CancelLoginDialog login_dialog_helper; 191 CancelLoginDialog login_dialog_helper;
166 192
167 ASSERT_TRUE(StartEmbeddedTestServer()); 193 ASSERT_TRUE(StartEmbeddedTestServer());
168 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_auth_required.html")) << 194 ASSERT_TRUE(RunExtensionSubtest("webrequest", "test_auth_required.html")) <<
169 message_; 195 message_;
170 } 196 }
171 197
(...skipping 380 matching lines...) Expand 10 before | Expand all | Expand 10 after
552 ASSERT_TRUE(granter); 578 ASSERT_TRUE(granter);
553 granter->RevokeForTesting(); 579 granter->RevokeForTesting();
554 base::RunLoop().RunUntilIdle(); 580 base::RunLoop().RunUntilIdle();
555 PerformXhrInPage(web_contents, kHost, port, kXhrPath); 581 PerformXhrInPage(web_contents, kHost, port, kXhrPath);
556 EXPECT_EQ(xhr_count, 582 EXPECT_EQ(xhr_count,
557 GetWebRequestCountFromBackgroundPage(extension, profile())); 583 GetWebRequestCountFromBackgroundPage(extension, profile()));
558 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension)); 584 EXPECT_EQ(BLOCKED_ACTION_WEB_REQUEST, runner->GetBlockedActions(extension));
559 } 585 }
560 586
561 } // namespace extensions 587 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698