| 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/diagnostics/recon_diagnostics.h" | 5 #include "chrome/browser/diagnostics/recon_diagnostics.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/files/file_util.h" | 9 #include "base/files/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| 11 #include "base/json/json_string_value_serializer.h" | 11 #include "base/json/json_string_value_serializer.h" |
| 12 #include "base/path_service.h" | 12 #include "base/path_service.h" |
| 13 #include "base/strings/string_number_conversions.h" | 13 #include "base/strings/string_number_conversions.h" |
| 14 #include "base/strings/string_util.h" | 14 #include "base/strings/string_util.h" |
| 15 #include "base/strings/stringprintf.h" | 15 #include "base/strings/stringprintf.h" |
| 16 #include "base/strings/utf_string_conversions.h" | 16 #include "base/strings/utf_string_conversions.h" |
| 17 #include "base/sys_info.h" | 17 #include "base/sys_info.h" |
| 18 #include "chrome/browser/diagnostics/diagnostics_test.h" | 18 #include "chrome/browser/diagnostics/diagnostics_test.h" |
| 19 #include "chrome/common/channel_info.h" |
| 19 #include "chrome/common/chrome_constants.h" | 20 #include "chrome/common/chrome_constants.h" |
| 20 #include "chrome/common/chrome_paths.h" | 21 #include "chrome/common/chrome_paths.h" |
| 21 #include "chrome/common/chrome_version_info.h" | |
| 22 #include "components/bookmarks/common/bookmark_constants.h" | 22 #include "components/bookmarks/common/bookmark_constants.h" |
| 23 #include "components/version_info/version_info.h" |
| 23 | 24 |
| 24 #if defined(OS_WIN) | 25 #if defined(OS_WIN) |
| 25 #include "base/win/windows_version.h" | 26 #include "base/win/windows_version.h" |
| 26 #include "chrome/browser/enumerate_modules_model_win.h" | 27 #include "chrome/browser/enumerate_modules_model_win.h" |
| 27 #include "chrome/installer/util/install_util.h" | 28 #include "chrome/installer/util/install_util.h" |
| 28 #endif | 29 #endif |
| 29 | 30 |
| 30 // Reconnaissance diagnostics. These are the first and most critical | 31 // Reconnaissance diagnostics. These are the first and most critical |
| 31 // diagnostic tests. Here we check for the existence of critical files. | 32 // diagnostic tests. Here we check for the existence of critical files. |
| 32 // TODO(cpu): Define if it makes sense to localize strings. | 33 // TODO(cpu): Define if it makes sense to localize strings. |
| (...skipping 318 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 351 TestPathInfo path_info_; | 352 TestPathInfo path_info_; |
| 352 DISALLOW_COPY_AND_ASSIGN(PathTest); | 353 DISALLOW_COPY_AND_ASSIGN(PathTest); |
| 353 }; | 354 }; |
| 354 | 355 |
| 355 // Check the version of Chrome. | 356 // Check the version of Chrome. |
| 356 class VersionTest : public DiagnosticsTest { | 357 class VersionTest : public DiagnosticsTest { |
| 357 public: | 358 public: |
| 358 VersionTest() : DiagnosticsTest(DIAGNOSTICS_VERSION_TEST) {} | 359 VersionTest() : DiagnosticsTest(DIAGNOSTICS_VERSION_TEST) {} |
| 359 | 360 |
| 360 bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { | 361 bool ExecuteImpl(DiagnosticsModel::Observer* observer) override { |
| 361 chrome::VersionInfo version_info; | 362 std::string current_version = version_info::GetVersionNumber(); |
| 362 std::string current_version = version_info.Version(); | |
| 363 if (current_version.empty()) { | 363 if (current_version.empty()) { |
| 364 RecordFailure(DIAG_RECON_EMPTY_VERSION, "Empty Version"); | 364 RecordFailure(DIAG_RECON_EMPTY_VERSION, "Empty Version"); |
| 365 return true; | 365 return true; |
| 366 } | 366 } |
| 367 std::string version_modifier = | 367 std::string version_modifier = chrome::GetChannelString(); |
| 368 chrome::VersionInfo::GetVersionStringModifier(); | |
| 369 if (!version_modifier.empty()) | 368 if (!version_modifier.empty()) |
| 370 current_version += " " + version_modifier; | 369 current_version += " " + version_modifier; |
| 371 #if defined(GOOGLE_CHROME_BUILD) | 370 #if defined(GOOGLE_CHROME_BUILD) |
| 372 current_version += " GCB"; | 371 current_version += " GCB"; |
| 373 #endif // defined(GOOGLE_CHROME_BUILD) | 372 #endif // defined(GOOGLE_CHROME_BUILD) |
| 374 RecordSuccess(current_version); | 373 RecordSuccess(current_version); |
| 375 return true; | 374 return true; |
| 376 } | 375 } |
| 377 | 376 |
| 378 private: | 377 private: |
| (...skipping 49 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 428 | 427 |
| 429 DiagnosticsTest* MakeResourcesFileTest() { | 428 DiagnosticsTest* MakeResourcesFileTest() { |
| 430 return new PathTest(kPathsToTest[2]); | 429 return new PathTest(kPathsToTest[2]); |
| 431 } | 430 } |
| 432 | 431 |
| 433 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } | 432 DiagnosticsTest* MakeUserDirTest() { return new PathTest(kPathsToTest[3]); } |
| 434 | 433 |
| 435 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } | 434 DiagnosticsTest* MakeVersionTest() { return new VersionTest(); } |
| 436 | 435 |
| 437 } // namespace diagnostics | 436 } // namespace diagnostics |
| OLD | NEW |