1 : // Copyright 2013 Google Inc. All Rights Reserved.
2 : //
3 : // Licensed under the Apache License, Version 2.0 (the "License");
4 : // you may not use this file except in compliance with the License.
5 : // You may obtain a copy of the License at
6 : //
7 : // http://www.apache.org/licenses/LICENSE-2.0
8 : //
9 : // Unless required by applicable law or agreed to in writing, software
10 : // distributed under the License is distributed on an "AS IS" BASIS,
11 : // WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12 : // See the License for the specific language governing permissions and
13 : // limitations under the License.
14 :
15 : #include "syzygy/pehacker/unittest_util.h"
16 :
17 : #include "base/json/json_reader.h"
18 : #include "gtest/gtest.h"
19 : #include "syzygy/core/unittest_util.h"
20 :
21 : namespace testing {
22 :
23 E : OperationTest::OperationTest() : previous_log_level_(0) {
24 E : }
25 :
26 E : void OperationTest::SetUp() {
27 E : Super::SetUp();
28 :
29 : // Silence logging.
30 E : previous_log_level_ = logging::GetMinLogLevel();
31 E : logging::SetMinLogLevel(logging::LOG_FATAL);
32 E : }
33 :
34 E : void OperationTest::TearDown() {
35 : // Restore logging to its previous level.
36 E : logging::SetMinLogLevel(previous_log_level_);
37 E : previous_log_level_ = 0;
38 :
39 E : Super::TearDown();
40 E : }
41 :
42 E : void OperationTest::InitConfig(const char* config) {
43 : scoped_ptr<base::Value> value(base::JSONReader::Read(
44 E : config, base::JSON_ALLOW_TRAILING_COMMAS));
45 E : ASSERT_TRUE(value.get() != NULL);
46 E : base::DictionaryValue* dict = NULL;
47 E : ASSERT_TRUE(value->GetAsDictionary(&dict));
48 E : config_.reset(dict);
49 E : value.release();
50 E : }
51 :
52 : } // namespace testing
|