| OLD | NEW |
| 1 // Copyright (c) 2016 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 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 "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" | 5 #import "ios/chrome/browser/ui/ntp/notification_promo_whats_new.h" |
| 6 | 6 |
| 7 #include <map> | 7 #include <map> |
| 8 | 8 |
| 9 #include "base/bind.h" | 9 #include "base/bind.h" |
| 10 #include "base/metrics/field_trial.h" | 10 #include "base/metrics/field_trial.h" |
| 11 #include "base/metrics/user_metrics.h" | 11 #include "base/metrics/user_metrics.h" |
| 12 #include "base/time/time.h" | 12 #include "base/time/time.h" |
| 13 #include "base/values.h" | 13 #include "base/values.h" |
| 14 #include "components/metrics/metrics_pref_names.h" | 14 #include "components/metrics/metrics_pref_names.h" |
| 15 #include "components/prefs/pref_registry_simple.h" | 15 #include "components/prefs/pref_registry_simple.h" |
| 16 #include "components/prefs/testing_pref_service.h" | 16 #include "components/prefs/testing_pref_service.h" |
| 17 #include "components/variations/variations_associated_data.h" | 17 #include "components/variations/variations_associated_data.h" |
| 18 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 18 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 19 #include "ios/chrome/grit/ios_chromium_strings.h" | 19 #include "ios/chrome/grit/ios_chromium_strings.h" |
| 20 #include "ios/public/provider/chrome/browser/images/whats_new_icon.h" | 20 #include "ios/public/provider/chrome/browser/images/whats_new_icon.h" |
| 21 #include "testing/platform_test.h" | 21 #include "testing/platform_test.h" |
| 22 #include "ui/base/l10n/l10n_util.h" | 22 #include "ui/base/l10n/l10n_util.h" |
| 23 #include "url/gurl.h" | 23 #include "url/gurl.h" |
| 24 | 24 |
| 25 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 26 #error "This file requires ARC support." |
| 27 #endif |
| 28 |
| 25 namespace { | 29 namespace { |
| 26 | 30 |
| 27 // Test fixture for NotificationPromoWhatsNew. | 31 // Test fixture for NotificationPromoWhatsNew. |
| 28 class NotificationPromoWhatsNewTest : public PlatformTest { | 32 class NotificationPromoWhatsNewTest : public PlatformTest { |
| 29 public: | 33 public: |
| 30 NotificationPromoWhatsNewTest() | 34 NotificationPromoWhatsNewTest() |
| 31 : promo_(&local_state_), | 35 : promo_(&local_state_), |
| 32 action_callback_( | 36 action_callback_( |
| 33 base::Bind(&NotificationPromoWhatsNewTest::OnUserAction, | 37 base::Bind(&NotificationPromoWhatsNewTest::OnUserAction, |
| 34 base::Unretained(this))), | 38 base::Unretained(this))), |
| (...skipping 190 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 225 EXPECT_EQ(1, GetUserActionCount("WhatsNewPromoViewed_RateThisAppPromo")); | 229 EXPECT_EQ(1, GetUserActionCount("WhatsNewPromoViewed_RateThisAppPromo")); |
| 226 | 230 |
| 227 // Verify that the promo closed user action count is 0 before |HandleClosed()| | 231 // Verify that the promo closed user action count is 0 before |HandleClosed()| |
| 228 // is called. | 232 // is called. |
| 229 EXPECT_EQ(0, GetUserActionCount("WhatsNewPromoClosed_RateThisAppPromo")); | 233 EXPECT_EQ(0, GetUserActionCount("WhatsNewPromoClosed_RateThisAppPromo")); |
| 230 promo_.HandleClosed(); | 234 promo_.HandleClosed(); |
| 231 EXPECT_EQ(1, GetUserActionCount("WhatsNewPromoClosed_RateThisAppPromo")); | 235 EXPECT_EQ(1, GetUserActionCount("WhatsNewPromoClosed_RateThisAppPromo")); |
| 232 } | 236 } |
| 233 | 237 |
| 234 } // namespace | 238 } // namespace |
| OLD | NEW |