OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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/diagnostics/diagnostics_model.h" | 5 #include "chrome/browser/diagnostics/diagnostics_model.h" |
6 | 6 |
7 #include <algorithm> | 7 #include <algorithm> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/command_line.h" | 10 #include "base/command_line.h" |
(...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
43 // code becomes: | 43 // code becomes: |
44 // 1- Inserting the appropriate tests into |tests_| | 44 // 1- Inserting the appropriate tests into |tests_| |
45 // 2- Overriding RunTest() to wrap it with the appropriate fatal exception | 45 // 2- Overriding RunTest() to wrap it with the appropriate fatal exception |
46 // handler for the OS. | 46 // handler for the OS. |
47 // This class owns the all the tests and will only delete them upon | 47 // This class owns the all the tests and will only delete them upon |
48 // destruction. | 48 // destruction. |
49 class DiagnosticsModelImpl : public DiagnosticsModel { | 49 class DiagnosticsModelImpl : public DiagnosticsModel { |
50 public: | 50 public: |
51 DiagnosticsModelImpl() : tests_run_(0) {} | 51 DiagnosticsModelImpl() : tests_run_(0) {} |
52 | 52 |
53 ~DiagnosticsModelImpl() override { STLDeleteElements(&tests_); } | 53 ~DiagnosticsModelImpl() override { base::STLDeleteElements(&tests_); } |
54 | 54 |
55 int GetTestRunCount() const override { return tests_run_; } | 55 int GetTestRunCount() const override { return tests_run_; } |
56 | 56 |
57 int GetTestAvailableCount() const override { return tests_.size(); } | 57 int GetTestAvailableCount() const override { return tests_.size(); } |
58 | 58 |
59 void RunAll(DiagnosticsModel::Observer* observer) override { | 59 void RunAll(DiagnosticsModel::Observer* observer) override { |
60 size_t test_count = tests_.size(); | 60 size_t test_count = tests_.size(); |
61 bool continue_running = true; | 61 bool continue_running = true; |
62 for (size_t i = 0; i != test_count; ++i) { | 62 for (size_t i = 0; i != test_count; ++i) { |
63 // If one of the diagnostic steps returns false, we want to | 63 // If one of the diagnostic steps returns false, we want to |
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
240 #if defined(OS_WIN) | 240 #if defined(OS_WIN) |
241 return new DiagnosticsModelWin(); | 241 return new DiagnosticsModelWin(); |
242 #elif defined(OS_MACOSX) | 242 #elif defined(OS_MACOSX) |
243 return new DiagnosticsModelMac(); | 243 return new DiagnosticsModelMac(); |
244 #elif defined(OS_POSIX) | 244 #elif defined(OS_POSIX) |
245 return new DiagnosticsModelPosix(); | 245 return new DiagnosticsModelPosix(); |
246 #endif | 246 #endif |
247 } | 247 } |
248 | 248 |
249 } // namespace diagnostics | 249 } // namespace diagnostics |
OLD | NEW |