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

Unified Diff: net/log/file_net_log_observer_unittest.cc

Issue 2973673003: Use FileNetLogObserver for implementing --log-net-log. (Closed)
Patch Set: check for null Created 3 years, 5 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
« components/net_log/chrome_net_log.cc ('K') | « net/log/file_net_log_observer.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: net/log/file_net_log_observer_unittest.cc
diff --git a/net/log/file_net_log_observer_unittest.cc b/net/log/file_net_log_observer_unittest.cc
index 9683e135ab69faceea5d8828cf35d27664e46155..75082a766fa141248a12e966488c8d367dead68b 100644
--- a/net/log/file_net_log_observer_unittest.cc
+++ b/net/log/file_net_log_observer_unittest.cc
@@ -287,6 +287,24 @@ TEST_P(FileNetLogObserverTest, ObserverDestroyedWithoutStopObserving) {
ASSERT_FALSE(LogFilesExist());
mmenke 2017/07/06 21:31:29 How is this guaranteed? Deletion occurs on anothe
eroman 2017/07/06 21:57:54 This is guaranteed by the changes I made in the de
}
+// Tests calling StopObserving() with a null closure.
+TEST_P(FileNetLogObserverTest, StopObservingNullClosure) {
+ CreateAndStartObserving(nullptr);
+
+ // Send dummy event
+ AddEntries(logger_.get(), 1, kDummyEventSize);
+
+ // The log files should have been started.
+ ASSERT_TRUE(LogFilesExist());
mmenke 2017/07/06 21:31:29 How is this guaranteed? The file is created on an
eroman 2017/07/06 21:57:54 same explanation as above.
+
+ logger_->StopObserving(nullptr, base::OnceClosure());
+
+ logger_.reset();
+
+ // Since the logger was explicitly stopped, its files should still exist.
+ ASSERT_TRUE(LogFilesExist());
+}
+
TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithNoEvents) {
TestClosure closure;
« components/net_log/chrome_net_log.cc ('K') | « net/log/file_net_log_observer.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698