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

Side by Side Diff: content/browser/memory/memory_coordinator_impl_unittest.cc

Issue 2739543002: Remove MemoryCoordinatorImpl::GetBrowserMemoryState() (Closed)
Patch Set: Created 3 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 | « content/browser/memory/memory_coordinator_impl.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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "content/browser/memory/memory_coordinator_impl.h" 5 #include "content/browser/memory/memory_coordinator_impl.h"
6 6
7 #include "base/memory/memory_coordinator_client_registry.h" 7 #include "base/memory/memory_coordinator_client_registry.h"
8 #include "base/memory/memory_coordinator_proxy.h" 8 #include "base/memory/memory_coordinator_proxy.h"
9 #include "base/memory/memory_pressure_monitor.h" 9 #include "base/memory/memory_pressure_monitor.h"
10 #include "base/memory/ptr_util.h" 10 #include "base/memory/ptr_util.h"
(...skipping 434 matching lines...) Expand 10 before | Expand all | Expand 10 after
445 RunUntilIdle(); 445 RunUntilIdle();
446 EXPECT_FALSE(client.did_state_changed()); 446 EXPECT_FALSE(client.did_state_changed());
447 EXPECT_EQ(base::MemoryState::NORMAL, client.state()); 447 EXPECT_EQ(base::MemoryState::NORMAL, client.state());
448 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(&client); 448 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(&client);
449 } 449 }
450 } 450 }
451 451
452 TEST_F(MemoryCoordinatorImplTest, SetMemoryStateForTesting) { 452 TEST_F(MemoryCoordinatorImplTest, SetMemoryStateForTesting) {
453 MockMemoryCoordinatorClient client; 453 MockMemoryCoordinatorClient client;
454 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(&client); 454 base::MemoryCoordinatorClientRegistry::GetInstance()->Register(&client);
455 EXPECT_EQ(base::MemoryState::NORMAL, coordinator_->GetBrowserMemoryState()); 455 EXPECT_EQ(base::MemoryState::NORMAL, coordinator_->GetCurrentMemoryState());
456 EXPECT_EQ(base::MemoryState::NORMAL, 456 EXPECT_EQ(base::MemoryState::NORMAL,
457 base::MemoryCoordinatorProxy::GetInstance()-> 457 base::MemoryCoordinatorProxy::GetInstance()->
458 GetCurrentMemoryState()); 458 GetCurrentMemoryState());
459 EXPECT_EQ(base::MemoryState::NORMAL, client.state()); 459 EXPECT_EQ(base::MemoryState::NORMAL, client.state());
460 460
461 base::MemoryCoordinatorProxy::GetInstance()->SetCurrentMemoryStateForTesting( 461 base::MemoryCoordinatorProxy::GetInstance()->SetCurrentMemoryStateForTesting(
462 base::MemoryState::THROTTLED); 462 base::MemoryState::THROTTLED);
463 EXPECT_EQ(base::MemoryState::THROTTLED, 463 EXPECT_EQ(base::MemoryState::THROTTLED,
464 coordinator_->GetBrowserMemoryState()); 464 coordinator_->GetCurrentMemoryState());
465 EXPECT_EQ(base::MemoryState::THROTTLED, 465 EXPECT_EQ(base::MemoryState::THROTTLED,
466 base::MemoryCoordinatorProxy::GetInstance()-> 466 base::MemoryCoordinatorProxy::GetInstance()->
467 GetCurrentMemoryState()); 467 GetCurrentMemoryState());
468 RunUntilIdle(); 468 RunUntilIdle();
469 EXPECT_TRUE(client.did_state_changed()); 469 EXPECT_TRUE(client.did_state_changed());
470 EXPECT_EQ(base::MemoryState::THROTTLED, client.state()); 470 EXPECT_EQ(base::MemoryState::THROTTLED, client.state());
471 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(&client); 471 base::MemoryCoordinatorClientRegistry::GetInstance()->Unregister(&client);
472 } 472 }
473 473
474 TEST_F(MemoryCoordinatorImplTest, ForceSetMemoryCondition) { 474 TEST_F(MemoryCoordinatorImplTest, ForceSetMemoryCondition) {
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
546 546
547 EXPECT_TRUE( 547 EXPECT_TRUE(
548 coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED)); 548 coordinator_->SetChildMemoryState(1, MemoryState::THROTTLED));
549 EXPECT_EQ(base::MemoryState::THROTTLED, 549 EXPECT_EQ(base::MemoryState::THROTTLED,
550 coordinator_->GetStateForProcess(process1.Handle())); 550 coordinator_->GetStateForProcess(process1.Handle()));
551 EXPECT_EQ(base::MemoryState::NORMAL, 551 EXPECT_EQ(base::MemoryState::NORMAL,
552 coordinator_->GetStateForProcess(process2.Handle())); 552 coordinator_->GetStateForProcess(process2.Handle()));
553 } 553 }
554 554
555 } // namespace content 555 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/memory/memory_coordinator_impl.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698