| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 18 matching lines...) Expand all Loading... |
| 29 class TestResource : public TaskManager::Resource { | 29 class TestResource : public TaskManager::Resource { |
| 30 public: | 30 public: |
| 31 TestResource() : refresh_called_(false) {} | 31 TestResource() : refresh_called_(false) {} |
| 32 | 32 |
| 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 gfx::ImageSkia GetIcon() const { return gfx::ImageSkia(); } | 39 virtual gfx::ImageSkia GetIcon() const OVERRIDE { return gfx::ImageSkia(); } |
| 40 virtual base::ProcessHandle GetProcess() const { | 40 virtual base::ProcessHandle GetProcess() const OVERRIDE { |
| 41 return base::GetCurrentProcessHandle(); | 41 return base::GetCurrentProcessHandle(); |
| 42 } | 42 } |
| 43 virtual int GetUniqueChildProcessId() const OVERRIDE { | 43 virtual int GetUniqueChildProcessId() const OVERRIDE { |
| 44 // In reality the unique child process ID is not the actual process ID, | 44 // In reality the unique child process ID is not the actual process ID, |
| 45 // but for testing purposes it shouldn't make difference. | 45 // but for testing purposes it shouldn't make difference. |
| 46 return static_cast<int>(base::GetCurrentProcId()); | 46 return static_cast<int>(base::GetCurrentProcId()); |
| 47 } | 47 } |
| 48 virtual Type GetType() const { return RENDERER; } | 48 virtual Type GetType() const OVERRIDE { return RENDERER; } |
| 49 virtual bool SupportNetworkUsage() const { return false; } | 49 virtual bool SupportNetworkUsage() const OVERRIDE { return false; } |
| 50 virtual void SetSupportNetworkUsage() { NOTREACHED(); } | 50 virtual void SetSupportNetworkUsage() OVERRIDE { NOTREACHED(); } |
| 51 virtual void Refresh() { refresh_called_ = true; } | 51 virtual void Refresh() OVERRIDE { refresh_called_ = true; } |
| 52 bool refresh_called() const { return refresh_called_; } | 52 bool refresh_called() const { return refresh_called_; } |
| 53 void set_refresh_called(bool refresh_called) { | 53 void set_refresh_called(bool refresh_called) { |
| 54 refresh_called_ = refresh_called; | 54 refresh_called_ = refresh_called; |
| 55 } | 55 } |
| 56 | 56 |
| 57 private: | 57 private: |
| 58 bool refresh_called_; | 58 bool refresh_called_; |
| 59 }; | 59 }; |
| 60 | 60 |
| 61 } // namespace | 61 } // namespace |
| (...skipping 53 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 TaskManagerModel* model = task_manager.model_; | 115 TaskManagerModel* model = task_manager.model_; |
| 116 TestResource resource; | 116 TestResource resource; |
| 117 | 117 |
| 118 task_manager.AddResource(&resource); | 118 task_manager.AddResource(&resource); |
| 119 ASSERT_FALSE(resource.refresh_called()); | 119 ASSERT_FALSE(resource.refresh_called()); |
| 120 model->update_state_ = TaskManagerModel::TASK_PENDING; | 120 model->update_state_ = TaskManagerModel::TASK_PENDING; |
| 121 model->Refresh(); | 121 model->Refresh(); |
| 122 ASSERT_TRUE(resource.refresh_called()); | 122 ASSERT_TRUE(resource.refresh_called()); |
| 123 task_manager.RemoveResource(&resource); | 123 task_manager.RemoveResource(&resource); |
| 124 } | 124 } |
| OLD | NEW |