| 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/recon_diagnostics.h" | 5 #include "chrome/browser/diagnostics/recon_diagnostics.h" |
| 6 | 6 |
| 7 #include <string> | 7 #include <string> |
| 8 | 8 |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/json/json_reader.h" | 10 #include "base/json/json_reader.h" |
| (...skipping 30 matching lines...) Expand all Loading... |
| 41 | 41 |
| 42 // Check that the flavor of the operating system is supported. | 42 // Check that the flavor of the operating system is supported. |
| 43 class OperatingSystemTest : public DiagnosticTest { | 43 class OperatingSystemTest : public DiagnosticTest { |
| 44 public: | 44 public: |
| 45 OperatingSystemTest() : DiagnosticTest(ASCIIToUTF16("Operating System")) {} | 45 OperatingSystemTest() : DiagnosticTest(ASCIIToUTF16("Operating System")) {} |
| 46 | 46 |
| 47 virtual int GetId() { return 0; } | 47 virtual int GetId() { return 0; } |
| 48 | 48 |
| 49 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { | 49 virtual bool ExecuteImpl(DiagnosticsModel::Observer* observer) { |
| 50 int version = 0; | 50 int version = 0; |
| 51 int major = 0; | 51 const int* service_pack; |
| 52 int minor = 0; | |
| 53 #if defined(OS_WIN) | 52 #if defined(OS_WIN) |
| 54 version = base::win::GetVersion(); | 53 version = base::win::GetVersion(); |
| 55 if (version < base::win::VERSION_XP) { | 54 if (version < base::win::VERSION_XP) { |
| 56 RecordFailure(ASCIIToUTF16("Windows 2000 or earlier")); | 55 RecordFailure(ASCIIToUTF16("Windows 2000 or earlier")); |
| 57 return false; | 56 return false; |
| 58 } | 57 } |
| 59 base::win::GetServicePackLevel(&major, &minor); | 58 service_pack = base::win::OSInfo::GetInstance()->service_pack(); |
| 60 if ((version == base::win::VERSION_XP) && (major < 2)) { | 59 if ((version == base::win::VERSION_XP) && (service_pack[0] < 2)) { |
| 61 RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier")); | 60 RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier")); |
| 62 return false; | 61 return false; |
| 63 } | 62 } |
| 64 #else | 63 #else |
| 65 // TODO(port): define the OS criteria for Linux and Mac. | 64 // TODO(port): define the OS criteria for Linux and Mac. |
| 66 #endif // defined(OS_WIN) | 65 #endif // defined(OS_WIN) |
| 67 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", | 66 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", |
| 68 base::SysInfo::OperatingSystemName().c_str(), | 67 base::SysInfo::OperatingSystemName().c_str(), |
| 69 base::SysInfo::OperatingSystemVersion().c_str(), | 68 base::SysInfo::OperatingSystemVersion().c_str(), |
| 70 version, major, minor))); | 69 version, service_pack[0], service_pack[1]))); |
| 71 return true; | 70 return true; |
| 72 } | 71 } |
| 73 | 72 |
| 74 private: | 73 private: |
| 75 DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest); | 74 DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest); |
| 76 }; | 75 }; |
| 77 | 76 |
| 78 // Check if any conflicting DLLs are loaded. | 77 // Check if any conflicting DLLs are loaded. |
| 79 class ConflictingDllsTest : public DiagnosticTest { | 78 class ConflictingDllsTest : public DiagnosticTest { |
| 80 public: | 79 public: |
| (...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 421 path = path.Append(chrome::kBookmarksFileName); | 420 path = path.Append(chrome::kBookmarksFileName); |
| 422 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); | 421 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); |
| 423 } | 422 } |
| 424 | 423 |
| 425 DiagnosticTest* MakeLocalStateTest() { | 424 DiagnosticTest* MakeLocalStateTest() { |
| 426 FilePath path; | 425 FilePath path; |
| 427 PathService::Get(chrome::DIR_USER_DATA, &path); | 426 PathService::Get(chrome::DIR_USER_DATA, &path); |
| 428 path = path.Append(chrome::kLocalStateFilename); | 427 path = path.Append(chrome::kLocalStateFilename); |
| 429 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); | 428 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); |
| 430 } | 429 } |
| OLD | NEW |