Home | History | Annotate | Download | only in diagnostics
      1 // Copyright (c) 2010 The Chromium Authors. All rights reserved.
      2 // Use of this source code is governed by a BSD-style license that can be
      3 // found in the LICENSE file.
      4 
      5 #include "chrome/browser/diagnostics/diagnostics_test.h"
      6 
      7 #include "base/file_path.h"
      8 #include "base/path_service.h"
      9 #include "chrome/common/chrome_constants.h"
     10 #include "chrome/common/chrome_paths.h"
     11 
     12 DiagnosticTest::DiagnosticTest(const string16& title)
     13     : title_(title), result_(DiagnosticsModel::TEST_NOT_RUN) {
     14 }
     15 
     16 DiagnosticTest::~DiagnosticTest() {
     17 }
     18 
     19 bool DiagnosticTest::Execute(DiagnosticsModel::Observer* observer,
     20                              DiagnosticsModel* model,
     21                              size_t index) {
     22   result_ = DiagnosticsModel::TEST_RUNNING;
     23   observer->OnProgress(index, 0, model);
     24   bool keep_going = ExecuteImpl(observer);
     25   observer->OnFinished(index, model);
     26   return keep_going;
     27 }
     28 
     29 string16 DiagnosticTest::GetTitle() {
     30   return title_;
     31 }
     32 
     33 DiagnosticsModel::TestResult DiagnosticTest::GetResult() {
     34   return result_;
     35 }
     36 
     37 string16 DiagnosticTest::GetAdditionalInfo() {
     38   return additional_info_;
     39 }
     40 
     41 void DiagnosticTest::RecordOutcome(const string16& additional_info,
     42                                    DiagnosticsModel::TestResult result) {
     43   additional_info_ = additional_info;
     44   result_ = result;
     45 }
     46 
     47 // static
     48 FilePath DiagnosticTest::GetUserDefaultProfileDir() {
     49   FilePath path;
     50   if (!PathService::Get(chrome::DIR_USER_DATA, &path))
     51     return FilePath();
     52   return path.AppendASCII(chrome::kNotSignedInProfile);
     53 }
     54