Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(10009)

Unified Diff: chrome/installer/setup/persistent_histogram_storage.h

Issue 2335313002: Always persist histograms from setup.exe. (Closed)
Patch Set: CR grt/bcwhite #4-5 Created 4 years, 3 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/installer/setup/installer_metrics.cc ('k') | chrome/installer/setup/persistent_histogram_storage.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/installer/setup/persistent_histogram_storage.h
diff --git a/chrome/test/base/mojo_test_connector.h b/chrome/installer/setup/persistent_histogram_storage.h
similarity index 15%
copy from chrome/test/base/mojo_test_connector.h
copy to chrome/installer/setup/persistent_histogram_storage.h
index bf295f1cb800041a48441fc8110454c48b201c07..db0871e7a6e08fe53c826acb61523aa029958813 100644
--- a/chrome/test/base/mojo_test_connector.h
+++ b/chrome/installer/setup/persistent_histogram_storage.h
@@ -2,56 +2,44 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#ifndef CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_
-#define CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_
-
-#include <memory>
+#ifndef CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_
+#define CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_
+#include "base/files/file_path.h"
#include "base/macros.h"
-#include "base/process/process_handle.h"
-#include "base/test/launcher/test_launcher.h"
-#include "services/shell/background/background_shell.h"
-#include "services/shell/public/interfaces/service.mojom.h"
-
-namespace base {
-class CommandLine;
-}
-
-namespace content {
-class TestState;
-}
-
-// MojoTestConnector in responsible for providing the necessary wiring for
-// test processes to get a mojo channel passed to them. To use this class
-// call PrepareForTest() prior to launching each test. It is expected
-// PrepareForTest() is called from content::TestLauncherDelegate::PreRunTest().
-class MojoTestConnector {
- public:
- // Switch added to command line of each test.
- static const char kTestSwitch[];
- // Command line switch added to all apps that are expected to be provided by
- // browser_tests.
- static const char kMashApp[];
+namespace installer {
- MojoTestConnector();
- ~MojoTestConnector();
+// When a PersistentHistogramStorage is destructed, histograms recorded during
+// its lifetime are persisted in the directory set by set_storage_dir().
+// Histograms are not persisted if set_storage_dir() has not been called or if
+// the storage directory does not exist on destruction.
+// PersistentHistogramStorage should be instantiated as early as possible in the
+// process lifetime and should never be instantiated again. Persisted histograms
+// will eventually be reported by the browser process.
+class PersistentHistogramStorage {
+ public:
+ PersistentHistogramStorage();
+ ~PersistentHistogramStorage();
- // Initializes the background thread the Shell runs on.
- shell::mojom::ServiceRequest Init();
+ // Sets |storage_dir| as the directory in which histograms will be persisted
+ // when this PersistentHistogramStorage is destructed.
+ void set_storage_dir(const base::FilePath& storage_dir) {
+ storage_dir_ = storage_dir;
+ }
- std::unique_ptr<content::TestState> PrepareForTest(
- base::CommandLine* command_line,
- base::TestLauncher::LaunchOptions* test_launch_options);
+ // Returns a directory in which setup histograms must be persisted to be
+ // reported by a product installed in |target_path|. Should be used as
+ // argument to set_storage_dir().
+ static base::FilePath GetReportedStorageDir(
+ const base::FilePath& target_path);
private:
- class NativeRunnerDelegateImpl;
+ base::FilePath storage_dir_;
- std::unique_ptr<NativeRunnerDelegateImpl> native_runner_delegate_;
-
- shell::BackgroundShell background_shell_;
-
- DISALLOW_COPY_AND_ASSIGN(MojoTestConnector);
+ DISALLOW_COPY_AND_ASSIGN(PersistentHistogramStorage);
};
-#endif // CHROME_TEST_BASE_MOJO_TEST_CONNECTOR_H_
+} // namespace installer
+
+#endif // CHROME_INSTALLER_SETUP_PERSISTENT_HISTOGRAM_STORAGE_H_
« no previous file with comments | « chrome/installer/setup/installer_metrics.cc ('k') | chrome/installer/setup/persistent_histogram_storage.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698