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 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
104 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT), | 104 EXPECT_EQ(l10n_util::GetStringUTF16(IDS_TASK_MANAGER_NA_CELL_TEXT), |
105 model->GetResourceNetworkUsage(0)); | 105 model->GetResourceNetworkUsage(0)); |
106 EXPECT_EQ(ASCIIToUTF16(kZeroCPUUsage), model->GetResourceCPUUsage(0)); | 106 EXPECT_EQ(ASCIIToUTF16(kZeroCPUUsage), model->GetResourceCPUUsage(0)); |
107 | 107 |
108 task_manager.RemoveResource(&resource2); | 108 task_manager.RemoveResource(&resource2); |
109 EXPECT_EQ(0, model->ResourceCount()); | 109 EXPECT_EQ(0, model->ResourceCount()); |
110 } | 110 } |
111 | 111 |
112 // Tests that the model is calling Refresh() on its resources. | 112 // Tests that the model is calling Refresh() on its resources. |
113 TEST_F(TaskManagerTest, RefreshCalled) { | 113 TEST_F(TaskManagerTest, RefreshCalled) { |
114 MessageLoop loop; | 114 base::MessageLoop loop; |
115 TaskManager task_manager; | 115 TaskManager task_manager; |
116 TaskManagerModel* model = task_manager.model_; | 116 TaskManagerModel* model = task_manager.model_; |
117 TestResource resource; | 117 TestResource resource; |
118 | 118 |
119 task_manager.AddResource(&resource); | 119 task_manager.AddResource(&resource); |
120 ASSERT_FALSE(resource.refresh_called()); | 120 ASSERT_FALSE(resource.refresh_called()); |
121 model->update_state_ = TaskManagerModel::TASK_PENDING; | 121 model->update_state_ = TaskManagerModel::TASK_PENDING; |
122 model->Refresh(); | 122 model->Refresh(); |
123 ASSERT_TRUE(resource.refresh_called()); | 123 ASSERT_TRUE(resource.refresh_called()); |
124 task_manager.RemoveResource(&resource); | 124 task_manager.RemoveResource(&resource); |
125 } | 125 } |
OLD | NEW |