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

Side by Side Diff: chrome/install_static/test/scoped_install_details.h

Issue 2476573004: Use InstallDetails in installer_util. (Closed)
Patch Set: sync to position 451835 Created 3 years, 10 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 unified diff | Download patch
« no previous file with comments | « chrome/install_static/install_util_unittest.cc ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2017 The Chromium Authors. All rights reserved. 1 // Copyright 2017 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 #ifndef CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_ 5 #ifndef CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_
6 #define CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_ 6 #define CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_
7 7
8 #include <memory> 8 #include <memory>
9 9
10 #include "base/macros.h" 10 #include "base/macros.h"
11 11
12 namespace install_static { 12 namespace install_static {
13 13
14 class InstallDetails; 14 class InstallDetails;
15 15
16 // A facility for tests to register an InstallDetails for the duration of a 16 // A facility for tests to register an InstallDetails for the duration of a
17 // test harness or test run. 17 // test harness or test run.
18 class ScopedInstallDetails { 18 class ScopedInstallDetails {
19 public: 19 public:
20 // Installs an InstallDetails instance that will report the install as being 20 // Installs an InstallDetails instance that will report the install as being
21 // at |system_level| and of mode |install_mode_index| (an InstallConstantIndex 21 // at |system_level| and of mode |install_mode_index| (an InstallConstantIndex
22 // value) of the current brand; see ../install_modes.h for details. 22 // value) of the current brand; see ../install_modes.h for details.
23 // TODO(grt): replace bool and int with more obvious types (e.g., enum).
23 explicit ScopedInstallDetails(bool system_level = false, 24 explicit ScopedInstallDetails(bool system_level = false,
24 int install_mode_index = 0); 25 int install_mode_index = 0);
25 ~ScopedInstallDetails(); 26 ~ScopedInstallDetails();
26 27
27 private: 28 private:
28 // A raw pointer to the InstallDetails instance created by this object. This 29 // A raw pointer to the InstallDetails instance created by this object. This
29 // is used only to assert that no intervening instances were swapped in yet 30 // is used only to assert that no intervening instances were swapped in yet
30 // not restored during the lifetime of this object. 31 // not restored during the lifetime of this object.
31 const InstallDetails* these_details_ = nullptr; 32 const InstallDetails* these_details_ = nullptr;
32 33
33 // The module's InstallDetails instance prior to the creation of this object. 34 // The module's InstallDetails instance prior to the creation of this object.
34 // This instance will be swapped back into place when this object is 35 // This instance will be swapped back into place when this object is
35 // destroyed. 36 // destroyed.
36 std::unique_ptr<const InstallDetails> previous_details_; 37 std::unique_ptr<const InstallDetails> previous_details_;
37 38
38 DISALLOW_COPY_AND_ASSIGN(ScopedInstallDetails); 39 DISALLOW_COPY_AND_ASSIGN(ScopedInstallDetails);
39 }; 40 };
40 41
41 } // namespace install_static 42 } // namespace install_static
42 43
43 #endif // CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_ 44 #endif // CHROME_INSTALL_STATIC_TEST_SCOPED_INSTALL_DETAILS_H_
OLDNEW
« no previous file with comments | « chrome/install_static/install_util_unittest.cc ('k') | chrome/installer/util/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698