summaryrefslogtreecommitdiffstats
path: root/chrome/installer/util/product_unittest.h
blob: 3419c7d185eb9ca407a22a3d00eff89f6d108e01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
// Copyright (c) 2011 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.

#ifndef CHROME_INSTALLER_UTIL_PRODUCT_UNITTEST_H_
#define CHROME_INSTALLER_UTIL_PRODUCT_UNITTEST_H_
#pragma once

#include <windows.h>

#include "base/file_path.h"
#include "base/file_util.h"
#include "base/memory/scoped_temp_dir.h"
#include "base/path_service.h"
#include "base/win/registry.h"
#include "testing/gtest/include/gtest/gtest.h"

class TestWithTempDir : public testing::Test {
 protected:
  virtual void SetUp();
  virtual void TearDown();

  ScopedTempDir test_dir_;
};

class TestWithTempDirAndDeleteTempOverrideKeys : public TestWithTempDir {
 protected:
  virtual void SetUp();
  virtual void TearDown();
};

// TODO(tommi): This is "borrowed" from Chrome Frame test code.  It should be
// moved to some common test utility file.
class TempRegKeyOverride {
 public:
  static const wchar_t kTempTestKeyPath[];

  TempRegKeyOverride(HKEY override, const wchar_t* temp_name);
  ~TempRegKeyOverride();

  static void DeleteAllTempKeys();

 protected:
  HKEY override_;
  base::win::RegKey temp_key_;
  std::wstring temp_name_;
};

#endif  // CHROME_INSTALLER_UTIL_PRODUCT_UNITTEST_H_