summaryrefslogtreecommitdiffstats
path: root/chrome/browser/diagnostics
diff options
context:
space:
mode:
authorcpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 23:22:52 +0000
committercpu@chromium.org <cpu@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-03-24 23:22:52 +0000
commit9f3c8499973c9e2943e3d602a8a0f91fe1402421 (patch)
tree4d7c7015f411d66ec7384ad14cca64ee1c4a3cdd /chrome/browser/diagnostics
parent1f8141255fef5bff961b8fc2e2387053aae87d78 (diff)
downloadchromium_src-9f3c8499973c9e2943e3d602a8a0f91fe1402421.zip
chromium_src-9f3c8499973c9e2943e3d602a8a0f91fe1402421.tar.gz
chromium_src-9f3c8499973c9e2943e3d602a8a0f91fe1402421.tar.bz2
Diagnostic mode shows wrong size for certain paths
- See the bug, it has a screenshot The problem is that we need to recourse over the directory. TEST=none BUG=39130 Review URL: http://codereview.chromium.org/1252002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@42556 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/diagnostics')
-rw-r--r--chrome/browser/diagnostics/recon_diagnostics.cc27
1 files changed, 19 insertions, 8 deletions
diff --git a/chrome/browser/diagnostics/recon_diagnostics.cc b/chrome/browser/diagnostics/recon_diagnostics.cc
index 3113211..dc00bb61 100644
--- a/chrome/browser/diagnostics/recon_diagnostics.cc
+++ b/chrome/browser/diagnostics/recon_diagnostics.cc
@@ -136,7 +136,9 @@ class VersionTest : public DiagnosticTest {
struct TestPathInfo {
const char* test_name;
- int dir_id;
+ int path_id;
+ bool is_directory;
+ bool is_optional;
bool test_writable;
int64 max_size;
};
@@ -145,10 +147,14 @@ const int64 kOneKilo = 1024;
const int64 kOneMeg = 1024 * kOneKilo;
const TestPathInfo kPathsToTest[] = {
- {"User data Directory", chrome::DIR_USER_DATA, true, 250 * kOneMeg},
- {"Local state file", chrome::FILE_LOCAL_STATE, true, 200 * kOneKilo},
- {"Dictionaries Directory", chrome::DIR_APP_DICTIONARIES, false, 0},
- {"Inspector Directory", chrome::DIR_INSPECTOR, false, 0}
+ {"User data Directory", chrome::DIR_USER_DATA,
+ true, false, true, 250 * kOneMeg},
+ {"Local state file", chrome::FILE_LOCAL_STATE,
+ false, false, true, 100 * kOneKilo},
+ {"Dictionaries Directory", chrome::DIR_APP_DICTIONARIES,
+ true, true, false, 0},
+ {"Inspector Directory", chrome::DIR_INSPECTOR,
+ true, false, false, 0}
};
// Check that the user's data directory exists and the paths are writeable.
@@ -168,7 +174,7 @@ class PathTest : public DiagnosticTest {
return false;
}
FilePath dir_or_file;
- if (!PathService::Get(path_info_.dir_id, &dir_or_file)) {
+ if (!PathService::Get(path_info_.path_id, &dir_or_file)) {
RecordStopFailure(ASCIIToUTF16("Path provider failure"));
return false;
}
@@ -177,8 +183,13 @@ class PathTest : public DiagnosticTest {
return true;
}
- int64 dir_or_file_size;
- if (!file_util::GetFileSize(dir_or_file, &dir_or_file_size)) {
+ int64 dir_or_file_size = 0;
+ if (path_info_.is_directory) {
+ dir_or_file_size = file_util::ComputeDirectorySize(dir_or_file);
+ } else {
+ file_util::GetFileSize(dir_or_file, &dir_or_file_size);
+ }
+ if (!dir_or_file_size && !path_info_.is_optional) {
RecordFailure(ASCIIToUTF16("Cannot obtain size"));
return true;
}