| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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_tester.h" | 5 #include "chrome/browser/task_manager/task_manager_tester.h" |
| 6 | 6 |
| 7 #include "base/memory/ptr_util.h" | 7 #include "base/memory/ptr_util.h" |
| 8 #include "chrome/browser/browser_process.h" | 8 #include "chrome/browser/browser_process.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/sessions/session_tab_helper.h" | 10 #include "chrome/browser/sessions/session_tab_helper.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 73 : model_(GetRealModel()) { | 73 : model_(GetRealModel()) { |
| 74 // Eavesdrop the model->view conversation, since the model only supports | 74 // Eavesdrop the model->view conversation, since the model only supports |
| 75 // single observation. | 75 // single observation. |
| 76 if (!on_resource_change.is_null()) { | 76 if (!on_resource_change.is_null()) { |
| 77 interceptor_.reset(new ScopedInterceptTableModelObserver( | 77 interceptor_.reset(new ScopedInterceptTableModelObserver( |
| 78 model_, model_->table_model_observer_, on_resource_change)); | 78 model_, model_->table_model_observer_, on_resource_change)); |
| 79 } | 79 } |
| 80 } | 80 } |
| 81 | 81 |
| 82 TaskManagerTester::~TaskManagerTester() { | 82 TaskManagerTester::~TaskManagerTester() { |
| 83 CHECK_EQ(GetRealModel(), model_) << "Task Manager should not be hidden " | 83 // Task Manager should not be hidden while TaskManagerTester is alive. This |
| 84 "while TaskManagerTester is alive. " | 84 // indicates a test bug. |
| 85 "This indicates a test bug."; | 85 CHECK_EQ(GetRealModel(), model_); |
| 86 } | 86 } |
| 87 | 87 |
| 88 // TaskManagerTester: | 88 // TaskManagerTester: |
| 89 int TaskManagerTester::GetRowCount() { | 89 int TaskManagerTester::GetRowCount() { |
| 90 return model_->RowCount(); | 90 return model_->RowCount(); |
| 91 } | 91 } |
| 92 | 92 |
| 93 base::string16 TaskManagerTester::GetRowTitle(int row) { | 93 base::string16 TaskManagerTester::GetRowTitle(int row) { |
| 94 return model_->GetText(row, IDS_TASK_MANAGER_TASK_COLUMN); | 94 return model_->GetText(row, IDS_TASK_MANAGER_TASK_COLUMN); |
| 95 } | 95 } |
| (...skipping 65 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 161 return model_->observed_task_manager(); | 161 return model_->observed_task_manager(); |
| 162 } | 162 } |
| 163 | 163 |
| 164 // static | 164 // static |
| 165 std::unique_ptr<TaskManagerTester> TaskManagerTester::Create( | 165 std::unique_ptr<TaskManagerTester> TaskManagerTester::Create( |
| 166 const base::Closure& callback) { | 166 const base::Closure& callback) { |
| 167 return base::WrapUnique(new TaskManagerTester(callback)); | 167 return base::WrapUnique(new TaskManagerTester(callback)); |
| 168 } | 168 } |
| 169 | 169 |
| 170 } // namespace task_manager | 170 } // namespace task_manager |
| OLD | NEW |