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

Side by Side Diff: net/disk_cache/simple/simple_test_util.h

Issue 826973002: replace COMPILE_ASSERT with static_assert in net/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: apply fixups Created 5 years, 11 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 | « net/disk_cache/simple/simple_index.h ('k') | net/dns/dns_config_service_posix.cc » ('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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 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 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_ 5 #ifndef NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_
6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_ 6 #define NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_
7 7
8 #include <string> 8 #include <string>
9 9
10 #include "base/basictypes.h" 10 #include "base/basictypes.h"
(...skipping 12 matching lines...) Expand all
23 public: 23 public:
24 static const size_t size = Size; 24 static const size_t size = Size;
25 25
26 ImmutableArray(const base::Callback<T (size_t index)>& initializer) { 26 ImmutableArray(const base::Callback<T (size_t index)>& initializer) {
27 for (size_t i = 0; i < size; ++i) 27 for (size_t i = 0; i < size; ++i)
28 data_[i] = initializer.Run(i); 28 data_[i] = initializer.Run(i);
29 } 29 }
30 30
31 template <size_t Index> 31 template <size_t Index>
32 const T& at() const { 32 const T& at() const {
33 COMPILE_ASSERT(Index < size, array_out_of_bounds); 33 static_assert(Index < size, "array out of bounds");
34 return data_[Index]; 34 return data_[Index];
35 } 35 }
36 36
37 private: 37 private:
38 T data_[size]; 38 T data_[size];
39 }; 39 };
40 40
41 // Creates a corrupt file to be used in tests. 41 // Creates a corrupt file to be used in tests.
42 bool CreateCorruptFileForTests(const std::string& key, 42 bool CreateCorruptFileForTests(const std::string& key,
43 const base::FilePath& cache_path); 43 const base::FilePath& cache_path);
44 44
45 } // namespace simple_backend 45 } // namespace simple_backend
46 } // namespace disk_cache 46 } // namespace disk_cache
47 47
48 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_ 48 #endif // NET_DISK_CACHE_SIMPLE_SIMPLE_TEST_UTIL_H_
OLDNEW
« no previous file with comments | « net/disk_cache/simple/simple_index.h ('k') | net/dns/dns_config_service_posix.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698