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 29 matching lines...) Expand all Loading... |
40 InstallTypeTest* g_install_type = 0; | 40 InstallTypeTest* g_install_type = 0; |
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; | |
51 int major = 0; | |
52 int minor = 0; | |
53 #if defined(OS_WIN) | 50 #if defined(OS_WIN) |
54 version = base::win::GetVersion(); | 51 base::win::Version version = base::win::GetVersion(); |
55 if (version < base::win::VERSION_XP) { | 52 if ((version < base::win::VERSION_XP) || |
56 RecordFailure(ASCIIToUTF16("Windows 2000 or earlier")); | 53 ((version == base::win::VERSION_XP) && |
57 return false; | 54 (base::win::OSInfo::GetInstance()->service_pack().major < 2))) { |
58 } | 55 RecordFailure(ASCIIToUTF16("Must have Windows XP SP2 or later")); |
59 base::win::GetServicePackLevel(&major, &minor); | |
60 if ((version == base::win::VERSION_XP) && (major < 2)) { | |
61 RecordFailure(ASCIIToUTF16("XP Service Pack 1 or earlier")); | |
62 return false; | 56 return false; |
63 } | 57 } |
64 #else | 58 #else |
65 // TODO(port): define the OS criteria for Linux and Mac. | 59 // TODO(port): define the OS criteria for Linux and Mac. |
66 #endif // defined(OS_WIN) | 60 #endif // defined(OS_WIN) |
67 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s (%d [%d:%d])", | 61 RecordSuccess(ASCIIToUTF16(StringPrintf("%s %s", |
68 base::SysInfo::OperatingSystemName().c_str(), | 62 base::SysInfo::OperatingSystemName().c_str(), |
69 base::SysInfo::OperatingSystemVersion().c_str(), | 63 base::SysInfo::OperatingSystemVersion().c_str()))); |
70 version, major, minor))); | |
71 return true; | 64 return true; |
72 } | 65 } |
73 | 66 |
74 private: | 67 private: |
75 DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest); | 68 DISALLOW_COPY_AND_ASSIGN(OperatingSystemTest); |
76 }; | 69 }; |
77 | 70 |
78 // Check if any conflicting DLLs are loaded. | 71 // Check if any conflicting DLLs are loaded. |
79 class ConflictingDllsTest : public DiagnosticTest { | 72 class ConflictingDllsTest : public DiagnosticTest { |
80 public: | 73 public: |
(...skipping 340 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
421 path = path.Append(chrome::kBookmarksFileName); | 414 path = path.Append(chrome::kBookmarksFileName); |
422 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); | 415 return new JSONTest(path, ASCIIToUTF16("BookMarks JSON"), 2 * kOneMeg); |
423 } | 416 } |
424 | 417 |
425 DiagnosticTest* MakeLocalStateTest() { | 418 DiagnosticTest* MakeLocalStateTest() { |
426 FilePath path; | 419 FilePath path; |
427 PathService::Get(chrome::DIR_USER_DATA, &path); | 420 PathService::Get(chrome::DIR_USER_DATA, &path); |
428 path = path.Append(chrome::kLocalStateFilename); | 421 path = path.Append(chrome::kLocalStateFilename); |
429 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); | 422 return new JSONTest(path, ASCIIToUTF16("Local State JSON"), 50 * kOneKilo); |
430 } | 423 } |
OLD | NEW |