| 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/location.h" | 7 #include "base/location.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/single_thread_task_runner.h" | 9 #include "base/single_thread_task_runner.h" |
| 10 #include "base/strings/pattern.h" |
| 10 #include "base/strings/string16.h" | 11 #include "base/strings/string16.h" |
| 11 #include "base/strings/string_util.h" | 12 #include "base/strings/string_util.h" |
| 12 #include "base/strings/utf_string_conversions.h" | 13 #include "base/strings/utf_string_conversions.h" |
| 13 #include "base/test/test_timeouts.h" | 14 #include "base/test/test_timeouts.h" |
| 14 #include "base/thread_task_runner_handle.h" | 15 #include "base/thread_task_runner_handle.h" |
| 15 #include "base/timer/timer.h" | 16 #include "base/timer/timer.h" |
| 16 #include "chrome/browser/browser_process.h" | 17 #include "chrome/browser/browser_process.h" |
| 17 #include "chrome/browser/profiles/profile.h" | 18 #include "chrome/browser/profiles/profile.h" |
| 18 #include "chrome/browser/task_manager/resource_provider.h" | 19 #include "chrome/browser/task_manager/resource_provider.h" |
| 19 #include "chrome/browser/task_manager/task_manager.h" | 20 #include "chrome/browser/task_manager/task_manager.h" |
| (...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 82 | 83 |
| 83 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, | 84 base::ThreadTaskRunnerHandle::Get()->PostTask(FROM_HERE, |
| 84 run_loop_.QuitClosure()); | 85 run_loop_.QuitClosure()); |
| 85 } | 86 } |
| 86 | 87 |
| 87 bool IsSatisfied() { return CountMatches() == required_count_; } | 88 bool IsSatisfied() { return CountMatches() == required_count_; } |
| 88 | 89 |
| 89 int CountMatches() { | 90 int CountMatches() { |
| 90 int match_count = 0; | 91 int match_count = 0; |
| 91 for (int i = 0; i < model_->ResourceCount(); i++) { | 92 for (int i = 0; i < model_->ResourceCount(); i++) { |
| 92 if (!MatchPattern(model_->GetResourceTitle(i), title_pattern_)) | 93 if (!base::MatchPattern(model_->GetResourceTitle(i), title_pattern_)) |
| 93 continue; | 94 continue; |
| 94 | 95 |
| 95 if (GetColumnValue(i) < min_column_value_) | 96 if (GetColumnValue(i) < min_column_value_) |
| 96 continue; | 97 continue; |
| 97 | 98 |
| 98 match_count++; | 99 match_count++; |
| 99 } | 100 } |
| 100 return match_count; | 101 return match_count; |
| 101 } | 102 } |
| 102 | 103 |
| (...skipping 155 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 258 base::string16 MatchUtility(const base::string16& title) { | 259 base::string16 MatchUtility(const base::string16& title) { |
| 259 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); | 260 return l10n_util::GetStringFUTF16(IDS_TASK_MANAGER_UTILITY_PREFIX, title); |
| 260 } | 261 } |
| 261 | 262 |
| 262 base::string16 MatchAnyUtility() { | 263 base::string16 MatchAnyUtility() { |
| 263 return MatchUtility(base::ASCIIToUTF16("*")); | 264 return MatchUtility(base::ASCIIToUTF16("*")); |
| 264 } | 265 } |
| 265 | 266 |
| 266 } // namespace browsertest_util | 267 } // namespace browsertest_util |
| 267 } // namespace task_manager | 268 } // namespace task_manager |
| OLD | NEW |