OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2008 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #include <memory> | 11 #include <memory> |
12 | 12 |
| 13 #include "webrtc/base/checks.h" |
13 #include "webrtc/base/fileutils.h" | 14 #include "webrtc/base/fileutils.h" |
14 #include "webrtc/base/gunit.h" | 15 #include "webrtc/base/gunit.h" |
15 #include "webrtc/base/optionsfile.h" | 16 #include "webrtc/base/optionsfile.h" |
16 #include "webrtc/base/pathutils.h" | 17 #include "webrtc/base/pathutils.h" |
17 | 18 |
18 namespace rtc { | 19 namespace rtc { |
19 | 20 |
20 static const std::string kTestOptionA = "test-option-a"; | 21 static const std::string kTestOptionA = "test-option-a"; |
21 static const std::string kTestOptionB = "test-option-b"; | 22 static const std::string kTestOptionB = "test-option-b"; |
22 static const std::string kTestString1 = "a string"; | 23 static const std::string kTestString1 = "a string"; |
(...skipping 16 matching lines...) Expand all Loading... |
39 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364. | 40 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364. |
40 #define MAYBE_OptionsFileTest DISABLED_OptionsFileTest | 41 #define MAYBE_OptionsFileTest DISABLED_OptionsFileTest |
41 #else | 42 #else |
42 #define MAYBE_OptionsFileTest OptionsFileTest | 43 #define MAYBE_OptionsFileTest OptionsFileTest |
43 #endif | 44 #endif |
44 | 45 |
45 class MAYBE_OptionsFileTest : public testing::Test { | 46 class MAYBE_OptionsFileTest : public testing::Test { |
46 public: | 47 public: |
47 MAYBE_OptionsFileTest() { | 48 MAYBE_OptionsFileTest() { |
48 Pathname dir; | 49 Pathname dir; |
49 ASSERT(Filesystem::GetTemporaryFolder(dir, true, NULL)); | 50 RTC_CHECK(Filesystem::GetTemporaryFolder(dir, true, NULL)); |
50 test_file_ = Filesystem::TempFilename(dir, ".testfile"); | 51 test_file_ = Filesystem::TempFilename(dir, ".testfile"); |
51 OpenStore(); | 52 OpenStore(); |
52 } | 53 } |
53 | 54 |
54 ~MAYBE_OptionsFileTest() override { | 55 ~MAYBE_OptionsFileTest() override { |
55 remove(test_file_.c_str()); | 56 remove(test_file_.c_str()); |
56 } | 57 } |
57 | 58 |
58 protected: | 59 protected: |
59 void OpenStore() { | 60 void OpenStore() { |
(...skipping 112 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
172 EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out)); | 173 EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out)); |
173 EXPECT_EQ(kTestString2, out); | 174 EXPECT_EQ(kTestString2, out); |
174 EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString)); | 175 EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString)); |
175 EXPECT_TRUE(store_->Save()); | 176 EXPECT_TRUE(store_->Save()); |
176 EXPECT_TRUE(store_->Load()); | 177 EXPECT_TRUE(store_->Load()); |
177 EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out)); | 178 EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out)); |
178 EXPECT_EQ(kEmptyString, out); | 179 EXPECT_EQ(kEmptyString, out); |
179 } | 180 } |
180 | 181 |
181 } // namespace rtc | 182 } // namespace rtc |
OLD | NEW |