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

Side by Side Diff: net/sdch/sdch_owner_unittest.cc

Issue 962313003: [net]: Disable SdchOwner's MemoryPressureListener to investigate http://crbug.com/447208. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Change #ifdef 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 | « net/sdch/sdch_owner.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/memory/memory_pressure_listener.h" 5 #include "base/memory/memory_pressure_listener.h"
6 #include "base/run_loop.h" 6 #include "base/run_loop.h"
7 #include "base/strings/stringprintf.h" 7 #include "base/strings/stringprintf.h"
8 #include "base/test/simple_test_clock.h" 8 #include "base/test/simple_test_clock.h"
9 #include "net/base/net_log.h" 9 #include "net/base/net_log.h"
10 #include "net/base/sdch_manager.h" 10 #include "net/base/sdch_manager.h"
(...skipping 443 matching lines...) Expand 10 before | Expand all | Expand 10 after
454 454
455 sdch_manager().ClearData(); 455 sdch_manager().ClearData();
456 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1)); 456 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1));
457 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); 457 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2));
458 458
459 // Addition should now succeed. 459 // Addition should now succeed.
460 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, nullptr)); 460 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, nullptr));
461 } 461 }
462 462
463 // Confirm memory pressure gets all the space back. 463 // Confirm memory pressure gets all the space back.
464 TEST_F(SdchOwnerTest, MemoryPressureReturnsSpace) { 464 // TODO(rmcilroy) Disabled while investigating http://crbug.com/447208 -
465 // re-enable once fixed.
466 TEST_F(SdchOwnerTest, DISABLED_MemoryPressureReturnsSpace) {
465 std::string server_hash_d1; 467 std::string server_hash_d1;
466 std::string server_hash_d2; 468 std::string server_hash_d2;
467 469
468 // Take up all the space. 470 // Take up all the space.
469 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, &server_hash_d1)); 471 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, &server_hash_d1));
470 472
471 // Addition should fail. 473 // Addition should fail.
472 EXPECT_FALSE(CreateAndAddDictionary(kMaxSizeForTesting, &server_hash_d2)); 474 EXPECT_FALSE(CreateAndAddDictionary(kMaxSizeForTesting, &server_hash_d2));
473 475
474 EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1)); 476 EXPECT_TRUE(DictionaryPresentInManager(server_hash_d1));
475 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); 477 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2));
476 478
477 base::MemoryPressureListener::NotifyMemoryPressure( 479 base::MemoryPressureListener::NotifyMemoryPressure(
478 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE); 480 base::MemoryPressureListener::MEMORY_PRESSURE_LEVEL_MODERATE);
479 // The notification may have (implementation note: does :-}) use a PostTask, 481 // The notification may have (implementation note: does :-}) use a PostTask,
480 // so we drain the local message queue. This should be safe (i.e. not have 482 // so we drain the local message queue. This should be safe (i.e. not have
481 // an inifinite number of messages) in a unit test. 483 // an inifinite number of messages) in a unit test.
482 base::RunLoop().RunUntilIdle(); 484 base::RunLoop().RunUntilIdle();
483 485
484 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1)); 486 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d1));
485 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2)); 487 EXPECT_FALSE(DictionaryPresentInManager(server_hash_d2));
486 488
487 // Addition should now succeed. 489 // Addition should now succeed.
488 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, nullptr)); 490 EXPECT_TRUE(CreateAndAddDictionary(kMaxSizeForTesting, nullptr));
489 } 491 }
490 492
491 } // namespace net 493 } // namespace net
OLDNEW
« no previous file with comments | « net/sdch/sdch_owner.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698