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

Unified Diff: net/log/file_net_log_observer_unittest.cc

Issue 2603523002: Move net-export thread-hopping code into NetLogFileWriter and add IO polled data. (Closed)
Patch Set: Fixed tommycli's nits from patchset 13 Created 3 years, 11 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 | « 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 ffe6ba45ca35de759cecd7dc00ab58ce662d9db8..a330e481f6d6f178b3088a9a31aaaefd67827c61 100644
--- a/net/log/file_net_log_observer_unittest.cc
+++ b/net/log/file_net_log_observer_unittest.cc
@@ -357,22 +357,19 @@ TEST_P(FileNetLogObserverTest, CustomConstants) {
ASSERT_EQ(kConstantString, constants_string);
}
-TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithContext) {
+TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithPolledData) {
TestClosure closure;
StartObserving(nullptr, nullptr);
- // Create unique context.
- TestURLRequestContext context(true);
- context.set_net_log(&net_log_);
- const int kDummyParam = 75;
- std::unique_ptr<HttpNetworkSession::Params> params(
- new HttpNetworkSession::Params);
- params->quic_idle_connection_timeout_seconds = kDummyParam;
- context.set_http_network_session_params(std::move(params));
- context.Init();
+ // Create dummy polled data
+ const char kDummyPolledDataPath[] = "dummy_path";
+ const char kDummyPolledDataString[] = "dummy_info";
+ std::unique_ptr<base::DictionaryValue> dummy_polled_data =
+ base::MakeUnique<base::DictionaryValue>();
+ dummy_polled_data->SetString(kDummyPolledDataPath, kDummyPolledDataString);
- logger_->StopObserving(&context, closure.closure());
+ logger_->StopObserving(std::move(dummy_polled_data), closure.closure());
closure.WaitForResult();
@@ -386,19 +383,15 @@ TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithContext) {
// Make sure additional information is present and validate it.
base::DictionaryValue* dict;
ASSERT_TRUE(root->GetAsDictionary(&dict));
- base::DictionaryValue* tab_info;
- base::DictionaryValue* quic_info;
- ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info));
- ASSERT_TRUE(tab_info->GetDictionary("quicInfo", &quic_info));
- base::Value* timeout_value = nullptr;
- int timeout;
- ASSERT_TRUE(
- quic_info->Get("idle_connection_timeout_seconds", &timeout_value));
- ASSERT_TRUE(timeout_value->GetAsInteger(&timeout));
- ASSERT_EQ(timeout, kDummyParam);
+ base::DictionaryValue* polled_data;
+ std::string dummy_string;
+ ASSERT_TRUE(dict->GetDictionary("polledData", &polled_data));
+ ASSERT_TRUE(polled_data->GetString(kDummyPolledDataPath, &dummy_string));
+ ASSERT_EQ(dummy_string, kDummyPolledDataString);
}
-TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithContextWithActiveRequest) {
+TEST_P(FileNetLogObserverTest,
+ GeneratesValidJSONWithPolledDataWithActiveRequest) {
TestClosure closure;
// Create context, start a request.
@@ -415,7 +408,8 @@ TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithContextWithActiveRequest) {
StartObserving(nullptr, &context);
- logger_->StopObserving(&context, closure.closure());
+ logger_->StopObserving(net::GetNetInfo(&context, NET_INFO_ALL_SOURCES),
+ closure.closure());
closure.WaitForResult();
@@ -429,8 +423,8 @@ TEST_P(FileNetLogObserverTest, GeneratesValidJSONWithContextWithActiveRequest) {
// Make sure additional information is present, but don't validate it.
base::DictionaryValue* dict;
ASSERT_TRUE(root->GetAsDictionary(&dict));
- base::DictionaryValue* tab_info;
- ASSERT_TRUE(dict->GetDictionary("tabInfo", &tab_info));
+ base::DictionaryValue* polled_data;
+ ASSERT_TRUE(dict->GetDictionary("polledData", &polled_data));
}
// Adds events concurrently from several different threads. The exact order of
« no previous file with comments | « 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