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

Side by Side Diff: chrome/browser/task_manager/task_manager_unittest.cc

Issue 9959101: Exposing the child process unique ID through the task manager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix for proper casting and comment fixup. Created 8 years, 8 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 "chrome/browser/task_manager/task_manager.h" 5 #include "chrome/browser/task_manager/task_manager.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop.h" 9 #include "base/message_loop.h"
10 #include "base/process_util.h" 10 #include "base/process_util.h"
(...skipping 22 matching lines...) Expand all
33 virtual string16 GetTitle() const OVERRIDE { 33 virtual string16 GetTitle() const OVERRIDE {
34 return ASCIIToUTF16("test title"); 34 return ASCIIToUTF16("test title");
35 } 35 }
36 virtual string16 GetProfileName() const OVERRIDE { 36 virtual string16 GetProfileName() const OVERRIDE {
37 return ASCIIToUTF16("test profile"); 37 return ASCIIToUTF16("test profile");
38 } 38 }
39 virtual SkBitmap GetIcon() const { return SkBitmap(); } 39 virtual SkBitmap GetIcon() const { return SkBitmap(); }
40 virtual base::ProcessHandle GetProcess() const { 40 virtual base::ProcessHandle GetProcess() const {
41 return base::GetCurrentProcessHandle(); 41 return base::GetCurrentProcessHandle();
42 } 42 }
43 virtual int GetUniqueChildProcessId() const OVERRIDE {
44 // In reality the unique child process ID is not the actual process ID,
45 // but for testing purposes it shouldn't make difference.
46 return static_cast<int>(base::GetCurrentProcId());
47 }
43 virtual Type GetType() const { return RENDERER; } 48 virtual Type GetType() const { return RENDERER; }
44 virtual bool SupportNetworkUsage() const { return false; } 49 virtual bool SupportNetworkUsage() const { return false; }
45 virtual void SetSupportNetworkUsage() { NOTREACHED(); } 50 virtual void SetSupportNetworkUsage() { NOTREACHED(); }
46 virtual void Refresh() { refresh_called_ = true; } 51 virtual void Refresh() { refresh_called_ = true; }
47 bool refresh_called() const { return refresh_called_; } 52 bool refresh_called() const { return refresh_called_; }
48 void set_refresh_called(bool refresh_called) { 53 void set_refresh_called(bool refresh_called) {
49 refresh_called_ = refresh_called; 54 refresh_called_ = refresh_called;
50 } 55 }
51 56
52 private: 57 private:
(...skipping 57 matching lines...) Expand 10 before | Expand all | Expand 10 after
110 TaskManagerModel* model = task_manager.model_; 115 TaskManagerModel* model = task_manager.model_;
111 TestResource resource; 116 TestResource resource;
112 117
113 task_manager.AddResource(&resource); 118 task_manager.AddResource(&resource);
114 ASSERT_FALSE(resource.refresh_called()); 119 ASSERT_FALSE(resource.refresh_called());
115 model->update_state_ = TaskManagerModel::TASK_PENDING; 120 model->update_state_ = TaskManagerModel::TASK_PENDING;
116 model->Refresh(); 121 model->Refresh();
117 ASSERT_TRUE(resource.refresh_called()); 122 ASSERT_TRUE(resource.refresh_called());
118 task_manager.RemoveResource(&resource); 123 task_manager.RemoveResource(&resource);
119 } 124 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698