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

Unified Diff: chrome/browser/power_usage_monitor/power_usage_monitor_unittest.cc

Issue 2456783002: Decouple PowerUsageMonitor{Impl} from //content/browser (Closed)
Patch Set: change define position of power_usage_moniter_ in ChromeBrowserMain Created 4 years, 2 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/power_usage_monitor/power_usage_monitor.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/power_usage_monitor/power_usage_monitor_unittest.cc
diff --git a/content/browser/power_usage_monitor_impl_unittest.cc b/chrome/browser/power_usage_monitor/power_usage_monitor_unittest.cc
similarity index 91%
rename from content/browser/power_usage_monitor_impl_unittest.cc
rename to chrome/browser/power_usage_monitor/power_usage_monitor_unittest.cc
index 1b3446f39bf325df717b66b82c5ff9da5f8c8407..1c94a3f5da7dd301fb8ccf926da24304fbba8c3e 100644
--- a/content/browser/power_usage_monitor_impl_unittest.cc
+++ b/chrome/browser/power_usage_monitor/power_usage_monitor_unittest.cc
@@ -2,7 +2,7 @@
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "content/browser/power_usage_monitor_impl.h"
+#include "chrome/browser/power_usage_monitor/power_usage_monitor.h"
#include <utility>
@@ -11,8 +11,6 @@
#include "device/battery/battery_monitor.mojom.h"
#include "testing/gtest/include/gtest/gtest.h"
-namespace content {
-
// Dummy ID to identify a phantom RenderProcessHost in tests.
const int kDummyRenderProcessHostID = 1;
@@ -28,9 +26,7 @@ class SystemInterfaceForTest : public PowerUsageMonitor::SystemInterface {
return num_pending_histogram_reports_;
}
- int discharge_percent_per_hour() const {
- return discharge_percent_per_hour_;
- }
+ int discharge_percent_per_hour() const { return discharge_percent_per_hour_; }
void AdvanceClockSeconds(int seconds) {
now_ += base::TimeDelta::FromSeconds(seconds);
@@ -71,8 +67,9 @@ class PowerUsageMonitorTest : public testing::Test {
monitor_->SetSystemInterfaceForTest(std::move(test_interface));
// Without live renderers, the monitor won't do anything.
- monitor_->OnRenderProcessNotification(NOTIFICATION_RENDERER_PROCESS_CREATED,
- kDummyRenderProcessHostID);
+ monitor_->OnRenderProcessNotification(
+ content::NOTIFICATION_RENDERER_PROCESS_CREATED,
+ kDummyRenderProcessHostID);
}
void UpdateBatteryStatus(bool charging, double battery_level) {
@@ -84,12 +81,13 @@ class PowerUsageMonitorTest : public testing::Test {
void KillTestRenderer() {
monitor_->OnRenderProcessNotification(
- NOTIFICATION_RENDERER_PROCESS_CLOSED, kDummyRenderProcessHostID);
+ content::NOTIFICATION_RENDERER_PROCESS_CLOSED,
+ kDummyRenderProcessHostID);
}
std::unique_ptr<PowerUsageMonitor> monitor_;
SystemInterfaceForTest* system_interface_;
- TestBrowserThreadBundle thread_bundle_;
+ content::TestBrowserThreadBundle thread_bundle_;
};
TEST_F(PowerUsageMonitorTest, StartStopQuickly) {
@@ -165,5 +163,3 @@ TEST_F(PowerUsageMonitorTest, NoRenderersCancelsInProgressMonitoring) {
ASSERT_EQ(0, system_interface_->num_pending_histogram_reports());
ASSERT_EQ(0, system_interface_->discharge_percent_per_hour());
}
-
-} // namespace content
« no previous file with comments | « chrome/browser/power_usage_monitor/power_usage_monitor.cc ('k') | chrome/test/BUILD.gn » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698