OLD | NEW |
1 // Copyright (c) 2008 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2008 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 #include "base/data_pack.h" | 5 #include "base/data_pack.h" |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/logging.h" | |
9 #include "base/path_service.h" | 8 #include "base/path_service.h" |
10 #include "base/string_piece.h" | 9 #include "base/string_piece.h" |
11 #include "testing/gtest/include/gtest/gtest.h" | 10 #include "testing/gtest/include/gtest/gtest.h" |
12 | 11 |
13 class DataPackTest : public testing::Test { | 12 class DataPackTest : public testing::Test { |
14 public: | 13 public: |
15 DataPackTest() { | 14 DataPackTest() { |
16 PathService::Get(base::DIR_SOURCE_ROOT, &data_path_); | 15 PathService::Get(base::DIR_SOURCE_ROOT, &data_path_); |
17 data_path_ = data_path_.Append( | 16 data_path_ = data_path_.Append( |
18 FILE_PATH_LITERAL("base/data/data_pack_unittest/sample.pak")); | 17 FILE_PATH_LITERAL("base/data/data_pack_unittest/sample.pak")); |
(...skipping 14 matching lines...) Expand all Loading... |
33 | 32 |
34 // Try reading zero-length data blobs, just in case. | 33 // Try reading zero-length data blobs, just in case. |
35 ASSERT_TRUE(pack.Get(1, &data)); | 34 ASSERT_TRUE(pack.Get(1, &data)); |
36 EXPECT_EQ(0U, data.length()); | 35 EXPECT_EQ(0U, data.length()); |
37 ASSERT_TRUE(pack.Get(10, &data)); | 36 ASSERT_TRUE(pack.Get(10, &data)); |
38 EXPECT_EQ(0U, data.length()); | 37 EXPECT_EQ(0U, data.length()); |
39 | 38 |
40 // Try looking up an invalid key. | 39 // Try looking up an invalid key. |
41 ASSERT_FALSE(pack.Get(140, &data)); | 40 ASSERT_FALSE(pack.Get(140, &data)); |
42 } | 41 } |
OLD | NEW |