1 : // Copyright 2012 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/pdb/pdb_dbi_stream.h"
16 :
17 : #include "base/files/file_util.h"
18 : #include "gtest/gtest.h"
19 : #include "syzygy/core/unittest_util.h"
20 : #include "syzygy/pdb/unittest_util.h"
21 :
22 : namespace pdb {
23 :
24 E : TEST(PdbDbiStreamTest, ReadValidDbiStream) {
25 : base::FilePath valid_dbi_path = testing::GetSrcRelativePath(
26 E : testing::kValidPdbDbiStreamPath);
27 :
28 : scoped_refptr<pdb::PdbFileStream> valid_dbi_stream =
29 E : testing::GetStreamFromFile(valid_dbi_path);
30 E : DbiStream dbi_stream;
31 E : EXPECT_TRUE(dbi_stream.Read(valid_dbi_stream.get()));
32 E : }
33 :
34 E : TEST(PdbDbiStreamTest, ReadInvalidDbiStream) {
35 : base::FilePath invalid_dbi_path = testing::GetSrcRelativePath(
36 E : testing::kInvalidPdbDbiStreamPath);
37 :
38 : scoped_refptr<pdb::PdbFileStream> invalid_dbi_stream =
39 E : testing::GetStreamFromFile(invalid_dbi_path);
40 :
41 E : DbiStream dbi_stream;
42 E : EXPECT_FALSE(dbi_stream.Read(invalid_dbi_stream.get()));
43 E : }
44 :
45 : } // namespace pdb
|