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

Unified Diff: chrome/browser/extensions/user_script_listener_unittest.cc

Issue 10914319: UserScriptListener: Don't resume requests that it didn't defer. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Fix bad comment Created 8 years, 3 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/extensions/user_script_listener.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/user_script_listener_unittest.cc
===================================================================
--- chrome/browser/extensions/user_script_listener_unittest.cc (revision 156237)
+++ chrome/browser/extensions/user_script_listener_unittest.cc (working copy)
@@ -290,6 +290,36 @@
EXPECT_EQ(kTestData, delegate.data_received());
}
+// Test when the script updated notification occurs before the throttle's
+// WillStartRequest function is called. This can occur when there are multiple
+// throttles.
+TEST_F(UserScriptListenerTest, ResumeBeforeStart) {
+ LoadTestExtension();
+ MessageLoop::current()->RunAllPending();
+ TestDelegate delegate;
+ TestURLRequestContext context;
+ GURL url(kMatchingUrl);
+ scoped_ptr<TestURLRequest> request(
+ new TestURLRequest(url, &delegate, &context));
+
+ ResourceThrottle* throttle =
+ listener_->CreateResourceThrottle(url, ResourceType::MAIN_FRAME);
+ ASSERT_TRUE(throttle);
+ request->SetUserData(NULL, new ThrottleController(request.get(), throttle));
+
+ ASSERT_FALSE(request->is_pending());
+
+ content::NotificationService::current()->Notify(
+ chrome::NOTIFICATION_USER_SCRIPTS_UPDATED,
+ content::Source<Profile>(profile_.get()),
+ content::NotificationService::NoDetails());
+ MessageLoop::current()->RunAllPending();
+
+ bool defer = false;
+ throttle->WillStartRequest(&defer);
+ ASSERT_FALSE(defer);
+}
+
} // namespace
} // namespace extensions
« no previous file with comments | « chrome/browser/extensions/user_script_listener.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698