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_main.h" | 5 #include "chrome/browser/diagnostics/diagnostics_main.h" |
6 | 6 |
7 #if defined(OS_POSIX) | 7 #if defined(OS_POSIX) |
8 #include <stdio.h> | 8 #include <stdio.h> |
9 #include <unistd.h> | 9 #include <unistd.h> |
10 #endif | 10 #endif |
11 | 11 |
12 #include <iostream> | 12 #include <iostream> |
13 | 13 |
14 #include "app/app_paths.h" | 14 #include "app/app_paths.h" |
15 #include "base/basictypes.h" | 15 #include "base/basictypes.h" |
16 #include "base/command_line.h" | 16 #include "base/command_line.h" |
17 #include "base/i18n/icu_util.h" | 17 #include "base/i18n/icu_util.h" |
18 #include "base/string_util.h" | 18 #include "base/string_util.h" |
19 #include "base/sys_string_conversions.h" | 19 #include "base/sys_string_conversions.h" |
20 #include "base/time.h" | 20 #include "base/time.h" |
21 #include "base/utf_string_conversions.h" | 21 #include "base/utf_string_conversions.h" |
22 #include "chrome/browser/diagnostics/diagnostics_model.h" | 22 #include "chrome/browser/diagnostics/diagnostics_model.h" |
23 #include "chrome/common/chrome_paths.h" | 23 #include "chrome/common/chrome_paths.h" |
| 24 #include "ui/base/ui_base_paths.h" |
24 | 25 |
25 namespace { | 26 namespace { |
26 // This is a minimalistic interface to wrap the platform console. This will be | 27 // This is a minimalistic interface to wrap the platform console. This will be |
27 // eventually replaced by a view that can be subclassed for each platform and | 28 // eventually replaced by a view that can be subclassed for each platform and |
28 // that the approved look and feel. | 29 // that the approved look and feel. |
29 class SimpleConsole { | 30 class SimpleConsole { |
30 public: | 31 public: |
31 enum Color { | 32 enum Color { |
32 DEFAULT, | 33 DEFAULT, |
33 RED, | 34 RED, |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
336 | 337 |
337 int DiagnosticsMain(const CommandLine& command_line) { | 338 int DiagnosticsMain(const CommandLine& command_line) { |
338 // If we can't initialize the console exit right away. | 339 // If we can't initialize the console exit right away. |
339 SimpleConsole* console = SimpleConsole::Create(); | 340 SimpleConsole* console = SimpleConsole::Create(); |
340 if (!console || !console->Init()) | 341 if (!console || !console->Init()) |
341 return 1; | 342 return 1; |
342 | 343 |
343 // We need to have the path providers registered. They both | 344 // We need to have the path providers registered. They both |
344 // return void so there is no early error signal that we can use. | 345 // return void so there is no early error signal that we can use. |
345 app::RegisterPathProvider(); | 346 app::RegisterPathProvider(); |
| 347 ui::RegisterPathProvider(); |
346 chrome::RegisterPathProvider(); | 348 chrome::RegisterPathProvider(); |
347 | 349 |
348 TestWriter writer(console); | 350 TestWriter writer(console); |
349 DiagnosticsModel* model = MakeDiagnosticsModel(command_line); | 351 DiagnosticsModel* model = MakeDiagnosticsModel(command_line); |
350 TestController controller(&writer); | 352 TestController controller(&writer); |
351 | 353 |
352 // Run all the diagnostic tests. | 354 // Run all the diagnostic tests. |
353 controller.Run(model); | 355 controller.Run(model); |
354 delete model; | 356 delete model; |
355 | 357 |
356 // The "press enter to continue" prompt isn't very unixy, so only do that on | 358 // The "press enter to continue" prompt isn't very unixy, so only do that on |
357 // Windows. | 359 // Windows. |
358 #if defined(OS_WIN) | 360 #if defined(OS_WIN) |
359 // Block here so the user can see the results. | 361 // Block here so the user can see the results. |
360 writer.WriteInfoText(L"Press [enter] to continue\n"); | 362 writer.WriteInfoText(L"Press [enter] to continue\n"); |
361 std::wstring txt; | 363 std::wstring txt; |
362 console->Read(&txt); | 364 console->Read(&txt); |
363 #endif | 365 #endif |
364 delete console; | 366 delete console; |
365 return 0; | 367 return 0; |
366 } | 368 } |
OLD | NEW |