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