Chromium Code Reviews| OLD | NEW |
|---|---|
| (Empty) | |
| 1 // Copyright 2017 The Chromium Authors. All rights reserved. | |
| 2 // Use of this source code is governed by a BSD-style license that can be | |
| 3 // found in the LICENSE file. | |
| 4 | |
| 5 #include "base/process/process_handle.h" | |
| 6 #include "base/run_loop.h" | |
| 7 #include "services/resource_coordinator/coordination_unit/coordination_unit_fact ory.h" | |
| 8 #include "services/resource_coordinator/coordination_unit/coordination_unit_impl .h" | |
| 9 #include "services/resource_coordinator/coordination_unit/coordination_unit_impl _base_test_unittest.h" | |
| 10 #include "services/resource_coordinator/public/cpp/coordination_unit_id.h" | |
| 11 #include "services/resource_coordinator/public/cpp/coordination_unit_types.h" | |
| 12 #include "testing/gtest/include/gtest/gtest.h" | |
| 13 | |
| 14 namespace resource_coordinator { | |
| 15 | |
| 16 namespace { | |
| 17 | |
| 18 class ProcessCoordinationUnitImplTest : public CoordinationUnitImplBaseTest {}; | |
| 19 | |
| 20 } // namespace | |
| 21 | |
| 22 TEST_F(ProcessCoordinationUnitImplTest, MeasureCPUUsage) { | |
| 23 base::ProcessHandle current_pid = base::GetCurrentProcessHandle(); | |
| 24 CoordinationUnitID cu_id(CoordinationUnitType::kProcess, current_pid); | |
| 25 | |
| 26 std::unique_ptr<CoordinationUnitImpl> coordination_unit_ = | |
| 27 CoordinationUnitFactory::CreateCoordinationUnit( | |
| 28 cu_id, ServiceContextRefFactory()); | |
|
oystein (OOO til 10th of July)
2017/05/17 23:06:07
Do we know what happens to the created ServiceCont
matthalp
2017/05/18 16:13:46
Maybe I am misunderstanding, but I think this has
oystein (OOO til 10th of July)
2017/05/18 21:24:32
Yeah but it's being created from the ServiceContex
| |
| 29 | |
| 30 base::RunLoop().RunUntilIdle(); | |
| 31 | |
| 32 EXPECT_LE(0.0, coordination_unit_->GetCPUUsageForTesting()); | |
|
oystein (OOO til 10th of July)
2017/05/17 23:06:07
Shouldn't this be EXPECT_GE?
matthalp
2017/05/18 16:13:46
EXPECT_LE(val1, val2) verifies val1 <= val2 [1] an
oystein (OOO til 10th of July)
2017/05/18 21:24:32
Makes sense!
| |
| 33 } | |
| 34 | |
| 35 } // namespace resource_coordinator | |
| OLD | NEW |