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

Side by Side Diff: chrome/browser/task_manager/providers/child_process_task_unittest.cc

Issue 2905403002: plumb network upload into the task manager (Closed)
Patch Set: js formatting, fixing spelling, modifying browser tests Created 3 years, 6 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 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "chrome/browser/task_manager/providers/child_process_task.h" 10 #include "chrome/browser/task_manager/providers/child_process_task.h"
(...skipping 113 matching lines...) Expand 10 before | Expand all | Expand 10 after
124 Task* task = provided_tasks_.begin()->second; 124 Task* task = provided_tasks_.begin()->second;
125 EXPECT_EQ(base::GetCurrentProcessHandle(), task->process_handle()); 125 EXPECT_EQ(base::GetCurrentProcessHandle(), task->process_handle());
126 EXPECT_EQ(base::GetCurrentProcId(), task->process_id()); 126 EXPECT_EQ(base::GetCurrentProcId(), task->process_id());
127 EXPECT_EQ(expected_name, task->title()); 127 EXPECT_EQ(expected_name, task->title());
128 EXPECT_EQ(Task::PLUGIN, task->GetType()); 128 EXPECT_EQ(Task::PLUGIN, task->GetType());
129 EXPECT_EQ(unique_id, task->GetChildProcessUniqueID()); 129 EXPECT_EQ(unique_id, task->GetChildProcessUniqueID());
130 EXPECT_EQ(base::string16(), task->GetProfileName()); 130 EXPECT_EQ(base::string16(), task->GetProfileName());
131 EXPECT_FALSE(task->ReportsSqliteMemory()); 131 EXPECT_FALSE(task->ReportsSqliteMemory());
132 EXPECT_FALSE(task->ReportsV8Memory()); 132 EXPECT_FALSE(task->ReportsV8Memory());
133 EXPECT_FALSE(task->ReportsWebCacheStats()); 133 EXPECT_FALSE(task->ReportsWebCacheStats());
134 EXPECT_FALSE(task->ReportsNetworkUsage());
135 134
136 // Make sure that the conversion from PID to Handle inside 135 // Make sure that the conversion from PID to Handle inside
137 // |GetTaskOfUrlRequest()| is working properly. 136 // |GetTaskOfUrlRequest()| is working properly.
138 Task* found_task = 137 Task* found_task =
139 provider.GetTaskOfUrlRequest(base::GetCurrentProcId(), 0, 0); 138 provider.GetTaskOfUrlRequest(base::GetCurrentProcId(), 0, 0);
140 ASSERT_EQ(task, found_task); 139 ASSERT_EQ(task, found_task);
141 const int64_t bytes_read = 1024; 140 const int64_t bytes_read = 1024;
142 found_task->OnNetworkBytesRead(bytes_read); 141 found_task->OnNetworkBytesRead(bytes_read);
143 found_task->Refresh(base::TimeDelta::FromSeconds(1), 142 found_task->Refresh(base::TimeDelta::FromSeconds(1),
144 REFRESH_TYPE_NETWORK_USAGE); 143 REFRESH_TYPE_NETWORK_USAGE);
145 144
146 EXPECT_TRUE(task->ReportsNetworkUsage()); 145 EXPECT_EQ(bytes_read, task->network_usage_rate());
147 EXPECT_EQ(bytes_read, task->network_usage());
148 146
149 // Clearing the observer won't notify us of any tasks removals even though 147 // Clearing the observer won't notify us of any tasks removals even though
150 // tasks will be actually deleted. 148 // tasks will be actually deleted.
151 provider.ClearObserver(); 149 provider.ClearObserver();
152 EXPECT_FALSE(provided_tasks_.empty()); 150 EXPECT_FALSE(provided_tasks_.empty());
153 EXPECT_TRUE(AreProviderContainersEmpty(provider)); 151 EXPECT_TRUE(AreProviderContainersEmpty(provider));
154 } 152 }
155 153
156 // Tests the translation of |content::ProcessType| to 154 // Tests the translation of |content::ProcessType| to
157 // |task_manager::Task::Type|. 155 // |task_manager::Task::Type|.
(...skipping 18 matching lines...) Expand all
176 provider.BrowserChildProcessHostDisconnected(data); 174 provider.BrowserChildProcessHostDisconnected(data);
177 EXPECT_TRUE(provided_tasks_.empty()); 175 EXPECT_TRUE(provided_tasks_.empty());
178 } 176 }
179 177
180 provider.ClearObserver(); 178 provider.ClearObserver();
181 EXPECT_TRUE(AreProviderContainersEmpty(provider)); 179 EXPECT_TRUE(AreProviderContainersEmpty(provider));
182 } 180 }
183 181
184 } // namespace task_manager 182 } // namespace task_manager
185 183
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698