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

Unified Diff: content/browser/streams/stream_unittest.cc

Issue 759823003: Introduce StreamRegistry::NotifyReaderAbortedBeforeRegistration() (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: AbortPendingStream Created 6 years 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 | « content/browser/streams/stream_registry.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: content/browser/streams/stream_unittest.cc
diff --git a/content/browser/streams/stream_unittest.cc b/content/browser/streams/stream_unittest.cc
index 6008e81af9a2691a3faf0d57892e6211f1a5ddf6..73c4ad0af50b84777dad1fa38392bba4658751eb 100644
--- a/content/browser/streams/stream_unittest.cc
+++ b/content/browser/streams/stream_unittest.cc
@@ -107,7 +107,7 @@ class TestStreamWriter : public StreamWriteObserver {
class TestStreamObserver : public StreamRegisterObserver {
public:
TestStreamObserver(const GURL& url, StreamRegistry* registry)
- : url_(url), registry_(registry), registered_(false), stream_(NULL) {
+ : url_(url), registry_(registry), registered_(false), stream_(nullptr) {
registry->SetRegisterObserver(url, this);
}
~TestStreamObserver() override { registry_->RemoveRegisterObserver(url_); }
@@ -312,12 +312,12 @@ TEST_F(StreamTest, MemoryExceedMemoryUsageLimit) {
// Written data (1000000 * 2) exceeded limit (1500000). |stream2| should be
// unregistered with |registry_|.
- EXPECT_EQ(NULL, registry_->GetStream(url2).get());
+ EXPECT_EQ(nullptr, registry_->GetStream(url2).get());
writer1.Write(stream1.get(), buffer, kMaxMemoryUsage - kBufferSize);
// Should be accepted since stream2 is unregistered and the new data is not
// so big to exceed the limit.
- EXPECT_FALSE(registry_->GetStream(url1).get() == NULL);
+ EXPECT_FALSE(registry_->GetStream(url1).get() == nullptr);
}
TEST_F(StreamTest, UnderMemoryUsageLimit) {
@@ -370,4 +370,13 @@ TEST_F(StreamTest, Flush) {
EXPECT_EQ(stream.get(), registry_->GetStream(url).get());
}
+TEST_F(StreamTest, AbortPendingStream) {
+ TestStreamWriter writer;
+
+ GURL url("blob://stream");
+ registry_->AbortPendingStream(url);
+ scoped_refptr<Stream> stream1(new Stream(registry_.get(), &writer, url));
+ ASSERT_EQ(nullptr, registry_->GetStream(url).get());
+}
+
} // namespace content
« no previous file with comments | « content/browser/streams/stream_registry.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698