-
Notifications
You must be signed in to change notification settings - Fork 123
Add User Messaging Platform iOS support #1412
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
652bb7e
246ab64
8f54fad
22a684f
77384f5
6be9f7c
37b9d32
3a46e8c
c6d98d3
063d678
7ea9f64
68a1698
08f5fa5
de1f488
57f9399
a730f83
2438a12
2cba298
a705ec5
d169883
454bd7e
47408f6
bdd4c57
da70121
b85feb3
453d3f8
d7ee1e1
a99c762
e147305
7a03dd9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -98,6 +98,8 @@ const char* kErrorDomain = "com.google.admob"; | |
#endif | ||
|
||
// Sample test device IDs to use in making the request. | ||
// You can replace these with actual device IDs for certain tests (e.g. UMP) | ||
// to work on hardware devices. | ||
const std::vector<std::string> kTestDeviceIDs = { | ||
"2077ef9a63d2b398840261c8221a0c9b", "098fe087d987c9a878965454a65654d7"}; | ||
|
||
|
@@ -136,6 +138,7 @@ static const std::vector<std::string> kNeighboringContentURLs = { | |
"test_url1", "test_url2", "test_url3"}; | ||
|
||
using app_framework::LogDebug; | ||
using app_framework::LogInfo; | ||
using app_framework::LogWarning; | ||
using app_framework::ProcessEvents; | ||
|
||
|
@@ -2498,6 +2501,7 @@ void FirebaseGmaUmpTest::InitializeUmp(ResetOption reset) { | |
|
||
void FirebaseGmaUmpTest::TerminateUmp() { | ||
if (consent_info_) { | ||
consent_info_->Reset(); | ||
delete consent_info_; | ||
consent_info_ = nullptr; | ||
} | ||
|
@@ -2591,6 +2595,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpRequestConsentInfoUpdateDebugEEA) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
firebase::Future<void> future = | ||
consent_info_->RequestConsentInfoUpdate(params); | ||
|
@@ -2610,6 +2616,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpRequestConsentInfoUpdateDebugNonEEA) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyNonEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
firebase::Future<void> future = | ||
consent_info_->RequestConsentInfoUpdate(params); | ||
|
@@ -2630,6 +2638,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpLoadForm) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2663,6 +2673,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpShowForm) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2678,7 +2690,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpShowForm) { | |
EXPECT_EQ(consent_info_->GetConsentFormStatus(), | ||
firebase::gma::ump::kConsentFormStatusAvailable); | ||
|
||
firebase::Future<void> future = consent_info_->ShowConsentForm(nullptr); | ||
firebase::Future<void> future = | ||
consent_info_->ShowConsentForm(app_framework::GetWindowController()); | ||
|
||
EXPECT_TRUE(future == consent_info_->ShowConsentFormLastResult()); | ||
|
||
|
@@ -2688,9 +2701,7 @@ TEST_F(FirebaseGmaUmpTest, TestUmpShowForm) { | |
firebase::gma::ump::kConsentStatusObtained); | ||
} | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadFormUnavailableDueUnderAgeOfConsent) { | ||
TEST_REQUIRES_USER_INTERACTION; | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadFormUnavailableDueToUnderAgeOfConsent) { | ||
using firebase::gma::ump::ConsentDebugSettings; | ||
using firebase::gma::ump::ConsentFormStatus; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
|
@@ -2700,24 +2711,65 @@ TEST_F(FirebaseGmaUmpTest, TestUmpLoadFormUnavailableDueUnderAgeOfConsent) { | |
params.tag_for_under_age_of_consent = true; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
||
EXPECT_EQ(consent_info_->GetConsentStatus(), | ||
firebase::gma::ump::kConsentStatusRequired); | ||
WaitForCompletion(consent_info_->LoadConsentForm(), "LoadConsentForm", | ||
firebase::gma::ump::kConsentFormErrorUnavailable); | ||
} | ||
|
||
EXPECT_EQ(consent_info_->GetConsentFormStatus(), | ||
firebase::gma::ump::kConsentFormStatusUnavailable); | ||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadFormUnavailableDebugNonEEA) { | ||
using firebase::gma::ump::ConsentDebugSettings; | ||
using firebase::gma::ump::ConsentFormStatus; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
||
ConsentRequestParameters params; | ||
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyNonEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
||
WaitForCompletion(consent_info_->LoadConsentForm(), "LoadConsentForm", | ||
firebase::gma::ump::kConsentFormErrorUnavailable); | ||
} | ||
|
||
EXPECT_EQ(consent_info_->GetConsentFormStatus(), | ||
firebase::gma::ump::kConsentFormStatusUnavailable); | ||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadAndShowIfRequiredDebugNonEEA) { | ||
using firebase::gma::ump::ConsentDebugSettings; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
||
ConsentRequestParameters params; | ||
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyNonEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
||
EXPECT_EQ(consent_info_->GetConsentStatus(), | ||
firebase::gma::ump::kConsentStatusNotRequired); | ||
|
||
firebase::Future<void> future = | ||
consent_info_->LoadAndShowConsentFormIfRequired( | ||
app_framework::GetWindowController()); | ||
|
||
EXPECT_TRUE(future == | ||
consent_info_->LoadAndShowConsentFormIfRequiredLastResult()); | ||
|
||
WaitForCompletion(future, "LoadAndShowConsentFormIfRequired"); | ||
} | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadAndShowIfRequired) { | ||
TEST_F(FirebaseGmaUmpTest, TestUmpLoadAndShowIfRequiredDebugEEA) { | ||
using firebase::gma::ump::ConsentDebugSettings; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
@@ -2728,6 +2780,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpLoadAndShowIfRequired) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2736,7 +2790,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpLoadAndShowIfRequired) { | |
firebase::gma::ump::kConsentStatusRequired); | ||
|
||
firebase::Future<void> future = | ||
consent_info_->LoadAndShowConsentFormIfRequired(nullptr); | ||
consent_info_->LoadAndShowConsentFormIfRequired( | ||
app_framework::GetWindowController()); | ||
|
||
EXPECT_TRUE(future == | ||
consent_info_->LoadAndShowConsentFormIfRequiredLastResult()); | ||
|
@@ -2759,6 +2814,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpPrivacyOptions) { | |
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2768,41 +2825,43 @@ TEST_F(FirebaseGmaUmpTest, TestUmpPrivacyOptions) { | |
|
||
EXPECT_FALSE(consent_info_->CanRequestAds()); | ||
|
||
WaitForCompletion(consent_info_->LoadAndShowConsentFormIfRequired(nullptr), | ||
WaitForCompletion(consent_info_->LoadAndShowConsentFormIfRequired( | ||
app_framework::GetWindowController()), | ||
"LoadAndShowConsentFormIfRequired"); | ||
|
||
EXPECT_EQ(consent_info_->GetConsentStatus(), | ||
firebase::gma::ump::kConsentStatusObtained); | ||
|
||
EXPECT_TRUE(consent_info_->CanRequestAds()); | ||
EXPECT_TRUE(consent_info_->CanRequestAds()) << "After consent obtained"; | ||
|
||
LogInfo( | ||
"******** On the Privacy Options screen that is about to appear, please " | ||
"select DO NOT CONSENT."); | ||
|
||
ProcessEvents(5000); | ||
|
||
EXPECT_EQ(consent_info_->GetPrivacyOptionsRequirementStatus(), | ||
firebase::gma::ump::kPrivacyOptionsRequirementStatusRequired); | ||
|
||
firebase::Future<void> future = | ||
consent_info_->ShowPrivacyOptionsForm(nullptr); | ||
firebase::Future<void> future = consent_info_->ShowPrivacyOptionsForm( | ||
app_framework::GetWindowController()); | ||
|
||
EXPECT_TRUE(future == consent_info_->ShowPrivacyOptionsFormLastResult()); | ||
|
||
WaitForCompletion(future, "ShowPrivacyOptionsForm"); | ||
|
||
EXPECT_EQ(consent_info_->GetConsentStatus(), | ||
firebase::gma::ump::kConsentStatusRequired); | ||
|
||
EXPECT_FALSE(consent_info_->CanRequestAds()); | ||
} | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestCanRequestAdsNonEEA) { | ||
using firebase::gma::ump::ConsentDebugSettings; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
||
TEST_REQUIRES_USER_INTERACTION; | ||
|
||
ConsentRequestParameters params; | ||
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyNonEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2818,12 +2877,12 @@ TEST_F(FirebaseGmaUmpTest, TestCanRequestAdsEEA) { | |
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
||
TEST_REQUIRES_USER_INTERACTION; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why do these no longer need user interaction? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Because I was able to add GetDebugDeviceId() to our test framework, so it can specify the debug settings even on FTL hardware. The ones that show the consent form and/or the privacy form still do require user interaction, though. |
||
|
||
ConsentRequestParameters params; | ||
params.tag_for_under_age_of_consent = false; | ||
params.debug_settings.debug_geography = | ||
firebase::gma::ump::kConsentDebugGeographyEEA; | ||
params.debug_settings.debug_device_ids = kTestDeviceIDs; | ||
params.debug_settings.debug_device_ids.push_back(GetDebugDeviceId()); | ||
|
||
WaitForCompletion(consent_info_->RequestConsentInfoUpdate(params), | ||
"RequestConsentInfoUpdate"); | ||
|
@@ -2834,7 +2893,30 @@ TEST_F(FirebaseGmaUmpTest, TestCanRequestAdsEEA) { | |
EXPECT_FALSE(consent_info_->CanRequestAds()); | ||
} | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestUmpCleanup) { | ||
TEST_F(FirebaseGmaUmpTest, TestUmpCleanupWithDelay) { | ||
using firebase::gma::ump::ConsentFormStatus; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
||
ConsentRequestParameters params; | ||
params.tag_for_under_age_of_consent = false; | ||
firebase::Future<void> future_request = | ||
consent_info_->RequestConsentInfoUpdate(params); | ||
firebase::Future<void> future_load = consent_info_->LoadConsentForm(); | ||
firebase::Future<void> future_show = | ||
consent_info_->ShowConsentForm(app_framework::GetWindowController()); | ||
|
||
ProcessEvents(5000); | ||
|
||
delete consent_info_; | ||
consent_info_ = nullptr; | ||
|
||
EXPECT_EQ(future_request.status(), firebase::kFutureStatusInvalid); | ||
EXPECT_EQ(future_load.status(), firebase::kFutureStatusInvalid); | ||
EXPECT_EQ(future_show.status(), firebase::kFutureStatusInvalid); | ||
} | ||
|
||
TEST_F(FirebaseGmaUmpTest, TestUmpCleanupRaceCondition) { | ||
using firebase::gma::ump::ConsentFormStatus; | ||
using firebase::gma::ump::ConsentRequestParameters; | ||
using firebase::gma::ump::ConsentStatus; | ||
|
@@ -2844,7 +2926,8 @@ TEST_F(FirebaseGmaUmpTest, TestUmpCleanup) { | |
firebase::Future<void> future_request = | ||
consent_info_->RequestConsentInfoUpdate(params); | ||
firebase::Future<void> future_load = consent_info_->LoadConsentForm(); | ||
firebase::Future<void> future_show = consent_info_->ShowConsentForm(nullptr); | ||
firebase::Future<void> future_show = | ||
consent_info_->ShowConsentForm(app_framework::GetWindowController()); | ||
|
||
delete consent_info_; | ||
consent_info_ = nullptr; | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Any changes need to be done to the update scripts so this gets updated automatically?