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

Side by Side Diff: third_party/leveldatabase/env_chromium_unittest.cc

Issue 862723002: leveldb: Moved to LevelDBEnv.IOError.BFE histogram entries. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased on ToT (to very pretty histograms.xml) - no changes. Created 5 years, 9 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 | « third_party/leveldatabase/env_chromium.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/files/file.h" 5 #include "base/files/file.h"
6 #include "base/files/file_enumerator.h" 6 #include "base/files/file_enumerator.h"
7 #include "base/files/file_path.h" 7 #include "base/files/file_path.h"
8 #include "base/files/file_util.h" 8 #include "base/files/file_util.h"
9 #include "base/files/scoped_temp_dir.h" 9 #include "base/files/scoped_temp_dir.h"
10 #include "base/test/test_suite.h" 10 #include "base/test/test_suite.h"
(...skipping 25 matching lines...) Expand all
36 EXPECT_EQ(in_method, method); 36 EXPECT_EQ(in_method, method);
37 EXPECT_EQ(base::File::FILE_ERROR_MAX, error); 37 EXPECT_EQ(base::File::FILE_ERROR_MAX, error);
38 } 38 }
39 39
40 TEST(ErrorEncoding, FileError) { 40 TEST(ErrorEncoding, FileError) {
41 const MethodID in_method = leveldb_env::kWritableFileClose; 41 const MethodID in_method = leveldb_env::kWritableFileClose;
42 const base::File::Error fe = base::File::FILE_ERROR_INVALID_OPERATION; 42 const base::File::Error fe = base::File::FILE_ERROR_INVALID_OPERATION;
43 const Status s = MakeIOError("Somefile.txt", "message", in_method, fe); 43 const Status s = MakeIOError("Somefile.txt", "message", in_method, fe);
44 MethodID method; 44 MethodID method;
45 base::File::Error error; 45 base::File::Error error;
46 EXPECT_EQ(leveldb_env::METHOD_AND_PFE, 46 EXPECT_EQ(leveldb_env::METHOD_AND_BFE,
47 ParseMethodAndError(s, &method, &error)); 47 ParseMethodAndError(s, &method, &error));
48 EXPECT_EQ(in_method, method); 48 EXPECT_EQ(in_method, method);
49 EXPECT_EQ(fe, error); 49 EXPECT_EQ(fe, error);
50 } 50 }
51 51
52 TEST(ErrorEncoding, NoEncodedMessage) { 52 TEST(ErrorEncoding, NoEncodedMessage) {
53 Status s = Status::IOError("Some message", "from leveldb itself"); 53 Status s = Status::IOError("Some message", "from leveldb itself");
54 MethodID method = leveldb_env::kRandomAccessFileRead; 54 MethodID method = leveldb_env::kRandomAccessFileRead;
55 base::File::Error error = base::File::FILE_ERROR_MAX; 55 base::File::Error error = base::File::FILE_ERROR_MAX;
56 EXPECT_EQ(leveldb_env::NONE, ParseMethodAndError(s, &method, &error)); 56 EXPECT_EQ(leveldb_env::NONE, ParseMethodAndError(s, &method, &error));
(...skipping 114 matching lines...) Expand 10 before | Expand all | Expand 10 after
171 EXPECT_TRUE(status.ok()); 171 EXPECT_TRUE(status.ok());
172 EXPECT_EQ(1U, result.size()); 172 EXPECT_EQ(1U, result.size());
173 173
174 // And a second time should also return one result 174 // And a second time should also return one result
175 status = env->GetChildren(dir.AsUTF8Unsafe(), &result); 175 status = env->GetChildren(dir.AsUTF8Unsafe(), &result);
176 EXPECT_TRUE(status.ok()); 176 EXPECT_TRUE(status.ok());
177 EXPECT_EQ(1U, result.size()); 177 EXPECT_EQ(1U, result.size());
178 } 178 }
179 179
180 int main(int argc, char** argv) { return base::TestSuite(argc, argv).Run(); } 180 int main(int argc, char** argv) { return base::TestSuite(argc, argv).Run(); }
OLDNEW
« no previous file with comments | « third_party/leveldatabase/env_chromium.cc ('k') | tools/metrics/histograms/histograms.xml » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698