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

Side by Side Diff: chrome/browser/renderer_host/web_cache_manager_unittest.cc

Issue 12258039: enable -Wstring-conversion when compiling with clang (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: enable on mac, better fix in web_data_service Created 7 years, 10 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 | Annotate | Revision Log
« no previous file with comments | « build/common.gypi ('k') | chrome/browser/webdata/web_data_service.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 (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/message_loop.h" 7 #include "base/message_loop.h"
8 #include "chrome/browser/renderer_host/web_cache_manager.h" 8 #include "chrome/browser/renderer_host/web_cache_manager.h"
9 #include "content/public/test/test_browser_thread.h" 9 #include "content/public/test/test_browser_thread.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
(...skipping 238 matching lines...) Expand 10 before | Expand all | Expand 10 after
249 &strategy)); 249 &strategy));
250 EXPECT_EQ(2U, strategy.size()); 250 EXPECT_EQ(2U, strategy.size());
251 251
252 AllocationStrategy::iterator iter = strategy.begin(); 252 AllocationStrategy::iterator iter = strategy.begin();
253 while (iter != strategy.end()) { 253 while (iter != strategy.end()) {
254 if (iter->first == kRendererID) 254 if (iter->first == kRendererID)
255 EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second); 255 EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second);
256 else if (iter->first == kRendererID2) 256 else if (iter->first == kRendererID2)
257 EXPECT_LE(kStats2.liveSize, iter->second); 257 EXPECT_LE(kStats2.liveSize, iter->second);
258 else 258 else
259 EXPECT_FALSE("Unexpected entry in strategy"); 259 ADD_FAILURE(); // Unexpected entry in strategy.
260 ++iter; 260 ++iter;
261 } 261 }
262 262
263 manager()->Remove(kRendererID); 263 manager()->Remove(kRendererID);
264 manager()->Remove(kRendererID2); 264 manager()->Remove(kRendererID2);
265 } 265 }
266 266
267 TEST_F(WebCacheManagerTest, AddToStrategyTest) { 267 TEST_F(WebCacheManagerTest, AddToStrategyTest) {
268 manager()->Add(kRendererID); 268 manager()->Add(kRendererID);
269 manager()->Add(kRendererID2); 269 manager()->Add(kRendererID2);
(...skipping 19 matching lines...) Expand all
289 size_t total_bytes = 0; 289 size_t total_bytes = 0;
290 AllocationStrategy::iterator iter = strategy.begin(); 290 AllocationStrategy::iterator iter = strategy.begin();
291 while (iter != strategy.end()) { 291 while (iter != strategy.end()) {
292 total_bytes += iter->second; 292 total_bytes += iter->second;
293 293
294 if (iter->first == kRendererID) 294 if (iter->first == kRendererID)
295 EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second); 295 EXPECT_LE(kStats.liveSize + kStats.deadSize, iter->second);
296 else if (iter->first == kRendererID2) 296 else if (iter->first == kRendererID2)
297 EXPECT_LE(kStats2.liveSize + kStats2.deadSize, iter->second); 297 EXPECT_LE(kStats2.liveSize + kStats2.deadSize, iter->second);
298 else 298 else
299 EXPECT_FALSE("Unexpected entry in strategy"); 299 ADD_FAILURE(); // Unexpected entry in strategy.
300 ++iter; 300 ++iter;
301 } 301 }
302 302
303 size_t expected_total_bytes = kExtraBytesToAllocate + 303 size_t expected_total_bytes = kExtraBytesToAllocate +
304 kStats.liveSize + kStats.deadSize + 304 kStats.liveSize + kStats.deadSize +
305 kStats2.liveSize + kStats2.deadSize; 305 kStats2.liveSize + kStats2.deadSize;
306 306
307 EXPECT_GE(expected_total_bytes, total_bytes); 307 EXPECT_GE(expected_total_bytes, total_bytes);
308 308
309 manager()->Remove(kRendererID); 309 manager()->Remove(kRendererID);
310 manager()->Remove(kRendererID2); 310 manager()->Remove(kRendererID2);
311 } 311 }
OLDNEW
« no previous file with comments | « build/common.gypi ('k') | chrome/browser/webdata/web_data_service.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698