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

Side by Side Diff: chrome/browser/chromeos/hats/hats_notification_controller.h

Issue 2169223002: Implements unittests for hats notification controller (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Created 4 years, 5 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 unified diff | Download patch
OLDNEW
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 #ifndef CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_ 5 #ifndef CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_
6 #define CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_ 6 #define CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_
7 7
8 #include "base/macros.h" 8 #include "base/macros.h"
9 #include "base/memory/weak_ptr.h" 9 #include "base/memory/weak_ptr.h"
10 #include "base/time/time.h" 10 #include "base/time/time.h"
(...skipping 19 matching lines...) Expand all
30 static const int kHatsNewDeviceThresholdDays; 30 static const int kHatsNewDeviceThresholdDays;
31 static const char kDelegateId[]; 31 static const char kDelegateId[];
32 static const char kNotificationId[]; 32 static const char kNotificationId[];
33 33
34 explicit HatsNotificationController(Profile* profile); 34 explicit HatsNotificationController(Profile* profile);
35 35
36 // Returns true if the survey needs to be displayed for the given |profile|. 36 // Returns true if the survey needs to be displayed for the given |profile|.
37 static bool ShouldShowSurveyToProfile(Profile* profile); 37 static bool ShouldShowSurveyToProfile(Profile* profile);
38 38
39 private: 39 private:
40 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
41 OldDevice_ShouldInitialize);
42 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
43 NoInternet_DoNotShowNotification);
44 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
45 InternetConnected_ShowNotification);
46 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
47 DismissNotification_ShouldUpdatePref);
48
40 ~HatsNotificationController() override; 49 ~HatsNotificationController() override;
41 50
42 // NotificationDelegate overrides: 51 // NotificationDelegate overrides:
43 void Initialize(bool is_new_device); 52 void Initialize(bool is_new_device);
44 void ButtonClick(int button_index) override; 53 void ButtonClick(int button_index) override;
45 void Close(bool by_user) override; 54 void Close(bool by_user) override;
46 std::string id() const override; 55 std::string id() const override;
47 56
48 // NetworkPortalDetector::Observer override: 57 // NetworkPortalDetector::Observer override:
49 void OnPortalDetectionCompleted( 58 void OnPortalDetectionCompleted(
50 const NetworkState* network, 59 const NetworkState* network,
51 const NetworkPortalDetector::CaptivePortalState& state) override; 60 const NetworkPortalDetector::CaptivePortalState& state) override;
52 61
53 Notification* CreateNotification(); 62 Notification* CreateNotification();
54 void UpdateLastInteractionTime(); 63 void UpdateLastInteractionTime();
55 64
56 Profile* profile_; 65 Profile* profile_;
57 base::WeakPtrFactory<HatsNotificationController> weak_pointer_factory_; 66 base::WeakPtrFactory<HatsNotificationController> weak_pointer_factory_;
58 67
59 DISALLOW_COPY_AND_ASSIGN(HatsNotificationController); 68 DISALLOW_COPY_AND_ASSIGN(HatsNotificationController);
60 }; 69 };
61 70
62 } // namespace chromeos 71 } // namespace chromeos
63 72
64 #endif // CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_ 73 #endif // CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698