Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(119)

Side by Side Diff: webrtc/rtc_base/optionsfile_unittest.cc

Issue 2995413002: Delete Filesystem::GetTemporaryFolder. (Closed)
Patch Set: Created 3 years, 4 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « webrtc/rtc_base/logging_unittest.cc ('k') | webrtc/rtc_base/unixfilesystem.h » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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/rtc_base/checks.h" 13 #include "webrtc/rtc_base/checks.h"
14 #include "webrtc/rtc_base/fileutils.h"
15 #include "webrtc/rtc_base/gunit.h" 14 #include "webrtc/rtc_base/gunit.h"
16 #include "webrtc/rtc_base/optionsfile.h" 15 #include "webrtc/rtc_base/optionsfile.h"
17 #include "webrtc/rtc_base/pathutils.h" 16 #include "webrtc/test/testsupport/fileutils.h"
18 17
19 namespace rtc { 18 namespace rtc {
20 19
21 static const std::string kTestOptionA = "test-option-a"; 20 static const std::string kTestOptionA = "test-option-a";
22 static const std::string kTestOptionB = "test-option-b"; 21 static const std::string kTestOptionB = "test-option-b";
23 static const std::string kTestString1 = "a string"; 22 static const std::string kTestString1 = "a string";
24 static const std::string kTestString2 = "different string"; 23 static const std::string kTestString2 = "different string";
25 static const std::string kOptionWithEquals = "foo=bar"; 24 static const std::string kOptionWithEquals = "foo=bar";
26 static const std::string kOptionWithNewline = "foo\nbar"; 25 static const std::string kOptionWithNewline = "foo\nbar";
27 static const std::string kValueWithEquals = "baz=quux"; 26 static const std::string kValueWithEquals = "baz=quux";
(...skipping 11 matching lines...) Expand all
39 #if defined (WEBRTC_ANDROID) 38 #if defined (WEBRTC_ANDROID)
40 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364. 39 // Fails on Android: https://bugs.chromium.org/p/webrtc/issues/detail?id=4364.
41 #define MAYBE_OptionsFileTest DISABLED_OptionsFileTest 40 #define MAYBE_OptionsFileTest DISABLED_OptionsFileTest
42 #else 41 #else
43 #define MAYBE_OptionsFileTest OptionsFileTest 42 #define MAYBE_OptionsFileTest OptionsFileTest
44 #endif 43 #endif
45 44
46 class MAYBE_OptionsFileTest : public testing::Test { 45 class MAYBE_OptionsFileTest : public testing::Test {
47 public: 46 public:
48 MAYBE_OptionsFileTest() { 47 MAYBE_OptionsFileTest() {
49 Pathname dir; 48 test_file_ =
50 RTC_CHECK(Filesystem::GetTemporaryFolder(dir, true, nullptr)); 49 webrtc::test::TempFilename(webrtc::test::OutputPath(), ".testfile");
51 test_file_ = Filesystem::TempFilename(dir, ".testfile");
52 OpenStore(); 50 OpenStore();
53 } 51 }
54 52
55 ~MAYBE_OptionsFileTest() override { 53 ~MAYBE_OptionsFileTest() override {
56 remove(test_file_.c_str()); 54 webrtc::test::RemoveFile(test_file_);
57 } 55 }
58 56
59 protected: 57 protected:
60 void OpenStore() { 58 void OpenStore() {
61 store_.reset(new OptionsFile(test_file_)); 59 store_.reset(new OptionsFile(test_file_));
62 } 60 }
63 61
64 std::unique_ptr<OptionsFile> store_; 62 std::unique_ptr<OptionsFile> store_;
65 63
66 private: 64 private:
(...skipping 106 matching lines...) Expand 10 before | Expand all | Expand 10 after
173 EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out)); 171 EXPECT_TRUE(store_->GetStringValue(kEmptyString, &out));
174 EXPECT_EQ(kTestString2, out); 172 EXPECT_EQ(kTestString2, out);
175 EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString)); 173 EXPECT_TRUE(store_->SetStringValue(kTestOptionB, kEmptyString));
176 EXPECT_TRUE(store_->Save()); 174 EXPECT_TRUE(store_->Save());
177 EXPECT_TRUE(store_->Load()); 175 EXPECT_TRUE(store_->Load());
178 EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out)); 176 EXPECT_TRUE(store_->GetStringValue(kTestOptionB, &out));
179 EXPECT_EQ(kEmptyString, out); 177 EXPECT_EQ(kEmptyString, out);
180 } 178 }
181 179
182 } // namespace rtc 180 } // namespace rtc
OLDNEW
« no previous file with comments | « webrtc/rtc_base/logging_unittest.cc ('k') | webrtc/rtc_base/unixfilesystem.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698