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

Unified Diff: chrome/browser/chromeos/policy/device_status_collector_browsertest.cc

Issue 885853002: Disable network state reporting. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 5 years, 11 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/chromeos/policy/device_status_collector.cc ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
diff --git a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
index bd321d3f238506d339f722d31bff4c8c444af0b7..c6b6fb798fb34b9b53ef40af1ec46af312ee0da5 100644
--- a/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
+++ b/chrome/browser/chromeos/policy/device_status_collector_browsertest.cc
@@ -93,7 +93,8 @@ class TestingDeviceStatusCollector : public policy::DeviceStatusCollector {
local_state,
provider,
location_update_requester,
- volume_info_fetcher) {
+ volume_info_fetcher),
+ kiosk_mode_(false) {
// Set the baseline time to a fixed value (1 AM) to prevent test flakiness
// due to a single activity period spanning two days.
SetBaselineTime(Time::Now().LocalMidnight() + TimeDelta::FromHours(1));
@@ -128,6 +129,14 @@ class TestingDeviceStatusCollector : public policy::DeviceStatusCollector {
RefreshSampleResourceUsage();
}
+ void set_kiosk_mode(bool is_kiosk) {
+ kiosk_mode_ = is_kiosk;
+ }
+
+ bool IsAutoLaunchedKioskSession() override {
+ return kiosk_mode_;
+ }
+
void RefreshSampleResourceUsage() {
// Refresh our samples. Sample more than kMaxHardwareSamples times to
// make sure that the code correctly caps the number of cached samples.
@@ -161,6 +170,8 @@ class TestingDeviceStatusCollector : public policy::DeviceStatusCollector {
int baseline_offset_periods_;
std::vector<double> mock_cpu_usage_;
+
+ bool kiosk_mode_;
};
// Return the total number of active milliseconds contained in a device
@@ -1025,7 +1036,18 @@ class DeviceStatusCollectorNetworkInterfacesTest
}
};
+TEST_F(DeviceStatusCollectorNetworkInterfacesTest, NoNetworkStateIfNotKiosk) {
+ // If not in an active kiosk session, there should be network interfaces
+ // reported, but no network state.
+ GetStatus();
+ EXPECT_LT(0, status_.network_interface_size());
+ EXPECT_EQ(0, status_.network_state_size());
+}
+
TEST_F(DeviceStatusCollectorNetworkInterfacesTest, NetworkInterfaces) {
+ // Mock that we are in kiosk mode so we report network state.
+ status_collector_->set_kiosk_mode(true);
+
// Interfaces should be reported by default.
GetStatus();
EXPECT_LT(0, status_.network_interface_size());
« no previous file with comments | « chrome/browser/chromeos/policy/device_status_collector.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698