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

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: fixed spelling/parellelism issues 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 126 matching lines...) Expand 10 before | Expand all | Expand 10 after
137 // |GetTaskOfUrlRequest()| is working properly. 137 // |GetTaskOfUrlRequest()| is working properly.
138 Task* found_task = 138 Task* found_task =
139 provider.GetTaskOfUrlRequest(base::GetCurrentProcId(), 0, 0); 139 provider.GetTaskOfUrlRequest(base::GetCurrentProcId(), 0, 0);
140 ASSERT_EQ(task, found_task); 140 ASSERT_EQ(task, found_task);
141 const int64_t bytes_read = 1024; 141 const int64_t bytes_read = 1024;
142 found_task->OnNetworkBytesRead(bytes_read); 142 found_task->OnNetworkBytesRead(bytes_read);
143 found_task->Refresh(base::TimeDelta::FromSeconds(1), 143 found_task->Refresh(base::TimeDelta::FromSeconds(1),
144 REFRESH_TYPE_NETWORK_USAGE); 144 REFRESH_TYPE_NETWORK_USAGE);
145 145
146 EXPECT_TRUE(task->ReportsNetworkUsage()); 146 EXPECT_TRUE(task->ReportsNetworkUsage());
147 EXPECT_EQ(bytes_read, task->network_usage()); 147 EXPECT_EQ(bytes_read, task->network_usage_rate());
148 148
149 // Clearing the observer won't notify us of any tasks removals even though 149 // Clearing the observer won't notify us of any tasks removals even though
150 // tasks will be actually deleted. 150 // tasks will be actually deleted.
151 provider.ClearObserver(); 151 provider.ClearObserver();
152 EXPECT_FALSE(provided_tasks_.empty()); 152 EXPECT_FALSE(provided_tasks_.empty());
153 EXPECT_TRUE(AreProviderContainersEmpty(provider)); 153 EXPECT_TRUE(AreProviderContainersEmpty(provider));
154 } 154 }
155 155
156 // Tests the translation of |content::ProcessType| to 156 // Tests the translation of |content::ProcessType| to
157 // |task_manager::Task::Type|. 157 // |task_manager::Task::Type|.
(...skipping 18 matching lines...) Expand all
176 provider.BrowserChildProcessHostDisconnected(data); 176 provider.BrowserChildProcessHostDisconnected(data);
177 EXPECT_TRUE(provided_tasks_.empty()); 177 EXPECT_TRUE(provided_tasks_.empty());
178 } 178 }
179 179
180 provider.ClearObserver(); 180 provider.ClearObserver();
181 EXPECT_TRUE(AreProviderContainersEmpty(provider)); 181 EXPECT_TRUE(AreProviderContainersEmpty(provider));
182 } 182 }
183 183
184 } // namespace task_manager 184 } // namespace task_manager
185 185
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698