summaryrefslogtreecommitdiffstats
path: root/tools/gn/test_with_scope.h
blob: df2c93ede612c6dd863661500b99c30574dd8b01 (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
// Copyright (c) 2013 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 TOOLS_GN_TEST_WITH_SCOPE_H_
#define TOOLS_GN_TEST_WITH_SCOPE_H_

#include "base/basictypes.h"
#include "tools/gn/build_settings.h"
#include "tools/gn/scope.h"
#include "tools/gn/settings.h"
#include "tools/gn/toolchain.h"

// A helper class for setting up a Scope that a test can use. It makes a
// toolchain and sets up all the build state.
class TestWithScope {
 public:
  TestWithScope();
  ~TestWithScope();

  BuildSettings* build_settings() { return &build_settings_; }
  Settings* settings() { return &settings_; }
  Toolchain* toolchain() { return &toolchain_; }
  Scope* scope() { return &scope_; }

 private:
  BuildSettings build_settings_;
  Settings settings_;
  Toolchain toolchain_;
  Scope scope_;

  DISALLOW_COPY_AND_ASSIGN(TestWithScope);
};

#endif  // TOOLS_GN_TEST_WITH_SCOPE_H_