OLD | NEW |
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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
6 #import <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
8 #include <map> | 8 #include <map> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 587 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
598 | 598 |
599 // Turn off cellular network usage, which should enable uploading. | 599 // Turn off cellular network usage, which should enable uploading. |
600 chrome_test_util::SetWWANStateTo(NO); | 600 chrome_test_util::SetWWANStateTo(NO); |
601 [self assertMetricsServiceEnabled:serviceType]; | 601 [self assertMetricsServiceEnabled:serviceType]; |
602 | 602 |
603 // kMetricsReportingEnabled ON and kMetricsReportingWifiOnly OFF | 603 // kMetricsReportingEnabled ON and kMetricsReportingWifiOnly OFF |
604 chrome_test_util::SetBooleanLocalStatePref( | 604 chrome_test_util::SetBooleanLocalStatePref( |
605 metrics::prefs::kMetricsReportingEnabled, YES); | 605 metrics::prefs::kMetricsReportingEnabled, YES); |
606 chrome_test_util::SetBooleanLocalStatePref(prefs::kMetricsReportingWifiOnly, | 606 chrome_test_util::SetBooleanLocalStatePref(prefs::kMetricsReportingWifiOnly, |
607 NO); | 607 NO); |
608 // Service should be always enabled regardless of network settings. | |
609 chrome_test_util::SetWWANStateTo(YES); | |
610 [self assertMetricsServiceEnabled:serviceType]; | 608 [self assertMetricsServiceEnabled:serviceType]; |
611 chrome_test_util::SetWWANStateTo(NO); | |
612 [self assertMetricsServiceDisabled:serviceType]; | |
613 #else | 609 #else |
614 // Development build. Do not allow any recording or uploading of data. | 610 // Development build. Do not allow any recording or uploading of data. |
615 // Specifically, the kMetricsReportingEnabled preference is completely | 611 // Specifically, the kMetricsReportingEnabled preference is completely |
616 // disregarded for non-official builds, and checking its value always returns | 612 // disregarded for non-official builds, and checking its value always returns |
617 // false (NO). | 613 // false (NO). |
618 // This tests that no matter the state change, pref or network connection, | 614 // This tests that no matter the state change, pref or network connection, |
619 // services remain disabled. | 615 // services remain disabled. |
620 | 616 |
621 // kMetricsReportingEnabled ON and kMetricsReportingWifiOnly ON | 617 // kMetricsReportingEnabled ON and kMetricsReportingWifiOnly ON |
622 chrome_test_util::SetBooleanLocalStatePref( | 618 chrome_test_util::SetBooleanLocalStatePref( |
(...skipping 415 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1038 performAction:grey_tap()]; | 1034 performAction:grey_tap()]; |
1039 [[EarlGrey selectElementWithMatcher:PrivacyButton()] | 1035 [[EarlGrey selectElementWithMatcher:PrivacyButton()] |
1040 performAction:grey_tap()]; | 1036 performAction:grey_tap()]; |
1041 [[EarlGrey selectElementWithMatcher:SendUsageDataButton()] | 1037 [[EarlGrey selectElementWithMatcher:SendUsageDataButton()] |
1042 performAction:grey_tap()]; | 1038 performAction:grey_tap()]; |
1043 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 1039 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
1044 [self closeSubSettingsMenu]; | 1040 [self closeSubSettingsMenu]; |
1045 } | 1041 } |
1046 | 1042 |
1047 @end | 1043 @end |
OLD | NEW |