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: content/common/indexed_db/indexed_db_key_unittest.cc

Issue 102593002: Convert string16 to base::string16 in content. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years 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 | Annotate | Revision Log
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 #include <vector> 5 #include <vector>
6 6
7 #include "base/basictypes.h" 7 #include "base/basictypes.h"
8 #include "base/memory/scoped_vector.h" 8 #include "base/memory/scoped_vector.h"
9 #include "base/strings/string16.h" 9 #include "base/strings/string16.h"
10 #include "content/common/indexed_db/indexed_db_key.h" 10 #include "content/common/indexed_db/indexed_db_key.h"
(...skipping 14 matching lines...) Expand all
25 estimates.push_back(static_cast<size_t>(16)); 25 estimates.push_back(static_cast<size_t>(16));
26 26
27 double number = 3.14159; 27 double number = 3.14159;
28 keys.push_back(IndexedDBKey(number, blink::WebIDBKeyTypeNumber)); 28 keys.push_back(IndexedDBKey(number, blink::WebIDBKeyTypeNumber));
29 estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double). 29 estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double).
30 30
31 double date = 1370884329.0; 31 double date = 1370884329.0;
32 keys.push_back(IndexedDBKey(date, blink::WebIDBKeyTypeDate)); 32 keys.push_back(IndexedDBKey(date, blink::WebIDBKeyTypeDate));
33 estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double). 33 estimates.push_back(static_cast<size_t>(24)); // Overhead + sizeof(double).
34 34
35 const string16 string(1024, static_cast<char16>('X')); 35 const base::string16 string(1024, static_cast<char16>('X'));
36 keys.push_back(IndexedDBKey(string)); 36 keys.push_back(IndexedDBKey(string));
37 // Overhead + string length * sizeof(char16). 37 // Overhead + string length * sizeof(char16).
38 estimates.push_back(static_cast<size_t>(2064)); 38 estimates.push_back(static_cast<size_t>(2064));
39 39
40 const size_t array_size = 1024; 40 const size_t array_size = 1024;
41 IndexedDBKey::KeyArray array; 41 IndexedDBKey::KeyArray array;
42 double value = 123.456; 42 double value = 123.456;
43 for (size_t i = 0; i < array_size; ++i) { 43 for (size_t i = 0; i < array_size; ++i) {
44 array.push_back(IndexedDBKey(value, blink::WebIDBKeyTypeNumber)); 44 array.push_back(IndexedDBKey(value, blink::WebIDBKeyTypeNumber));
45 } 45 }
46 keys.push_back(IndexedDBKey(array)); 46 keys.push_back(IndexedDBKey(array));
47 // Overhead + array length * (Overhead + sizeof(double)). 47 // Overhead + array length * (Overhead + sizeof(double)).
48 estimates.push_back(static_cast<size_t>(24592)); 48 estimates.push_back(static_cast<size_t>(24592));
49 49
50 ASSERT_EQ(keys.size(), estimates.size()); 50 ASSERT_EQ(keys.size(), estimates.size());
51 for (size_t i = 0; i < keys.size(); ++i) { 51 for (size_t i = 0; i < keys.size(); ++i) {
52 EXPECT_EQ(estimates[i], keys[i].size_estimate()); 52 EXPECT_EQ(estimates[i], keys[i].size_estimate());
53 } 53 }
54 } 54 }
55 55
56 } // namespace 56 } // namespace
57 57
58 } // namespace content 58 } // namespace content
OLDNEW
« no previous file with comments | « content/common/indexed_db/indexed_db_key_path.cc ('k') | content/common/indexed_db/indexed_db_messages.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698