| 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_browsertest_util.h" | 5 #include "chrome/browser/task_manager/task_manager_browsertest_util.h" |
| 6 | 6 |
| 7 #include "base/command_line.h" |
| 7 #include "base/location.h" | 8 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 9 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 10 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/pattern.h" | 11 #include "base/strings/pattern.h" |
| 11 #include "base/strings/string16.h" | 12 #include "base/strings/string16.h" |
| 12 #include "base/strings/string_util.h" | 13 #include "base/strings/string_util.h" |
| 13 #include "base/strings/utf_string_conversions.h" | 14 #include "base/strings/utf_string_conversions.h" |
| 14 #include "base/test/test_timeouts.h" | 15 #include "base/test/test_timeouts.h" |
| 15 #include "base/thread_task_runner_handle.h" | 16 #include "base/thread_task_runner_handle.h" |
| 16 #include "base/timer/timer.h" | 17 #include "base/timer/timer.h" |
| 17 #include "chrome/browser/browser_process.h" | 18 #include "chrome/browser/browser_process.h" |
| 18 #include "chrome/browser/profiles/profile.h" | 19 #include "chrome/browser/profiles/profile.h" |
| 19 #include "chrome/browser/task_manager/resource_provider.h" | 20 #include "chrome/browser/task_manager/resource_provider.h" |
| 20 #include "chrome/browser/task_manager/task_manager.h" | 21 #include "chrome/browser/task_manager/task_manager.h" |
| 22 #include "chrome/common/chrome_switches.h" |
| 21 #include "chrome/grit/generated_resources.h" | 23 #include "chrome/grit/generated_resources.h" |
| 22 #include "extensions/strings/grit/extensions_strings.h" | 24 #include "extensions/strings/grit/extensions_strings.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 25 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "ui/base/l10n/l10n_util.h" | 26 #include "ui/base/l10n/l10n_util.h" |
| 25 | 27 |
| 26 namespace task_manager { | 28 namespace task_manager { |
| 27 namespace browsertest_util { | 29 namespace browsertest_util { |
| 28 | 30 |
| 29 namespace { | 31 namespace { |
| 30 | 32 |
| (...skipping 139 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 170 const int required_count_; | 172 const int required_count_; |
| 171 const base::string16 title_pattern_; | 173 const base::string16 title_pattern_; |
| 172 const ColumnSpecifier column_specifier_; | 174 const ColumnSpecifier column_specifier_; |
| 173 const size_t min_column_value_; | 175 const size_t min_column_value_; |
| 174 base::RunLoop run_loop_; | 176 base::RunLoop run_loop_; |
| 175 base::OneShotTimer<ResourceChangeObserver> timer_; | 177 base::OneShotTimer<ResourceChangeObserver> timer_; |
| 176 }; | 178 }; |
| 177 | 179 |
| 178 } // namespace | 180 } // namespace |
| 179 | 181 |
| 182 void EnableOldTaskManager() { |
| 183 base::CommandLine::ForCurrentProcess()->AppendSwitch( |
| 184 switches::kDisableNewTaskManager); |
| 185 } |
| 186 |
| 180 void WaitForTaskManagerRows(int required_count, | 187 void WaitForTaskManagerRows(int required_count, |
| 181 const base::string16& title_pattern) { | 188 const base::string16& title_pattern) { |
| 182 TaskManagerModel* model = TaskManager::GetInstance()->model(); | 189 TaskManagerModel* model = TaskManager::GetInstance()->model(); |
| 183 | 190 |
| 184 const int column_value_dont_care = 0; | 191 const int column_value_dont_care = 0; |
| 185 ResourceChangeObserver observer(model, required_count, title_pattern, | 192 ResourceChangeObserver observer(model, required_count, title_pattern, |
| 186 COLUMN_NONE, column_value_dont_care); | 193 COLUMN_NONE, column_value_dont_care); |
| 187 model->AddObserver(&observer); | 194 model->AddObserver(&observer); |
| 188 observer.RunUntilSatisfied(); | 195 observer.RunUntilSatisfied(); |
| 189 model->RemoveObserver(&observer); | 196 model->RemoveObserver(&observer); |
| (...skipping 69 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 259 base::string16 MatchUtility(const base::string16& title) { | 266 base::string16 MatchUtility(const base::string16& title) { |
| 260 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); | 267 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); |
| 261 } | 268 } |
| 262 | 269 |
| 263 base::string16 MatchAnyUtility() { | 270 base::string16 MatchAnyUtility() { |
| 264 return MatchUtility(base::ASCIIToUTF16("*")); | 271 return MatchUtility(base::ASCIIToUTF16("*")); |
| 265 } | 272 } |
| 266 | 273 |
| 267 } // namespace browsertest_util | 274 } // namespace browsertest_util |
| 268 } // namespace task_manager | 275 } // namespace task_manager |
| OLD | NEW |