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

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: Implements unittests for hats notification controller Created 4 years, 4 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
« no previous file with comments | « no previous file | chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 class HatsNotificationControllerTest;
41 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
42 NewDevice_ShouldNotShowNotification);
43 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
44 OldDevice_ShouldShowNotification);
45 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
46 NoInternet_DoNotShowNotification);
47 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
48 InternetConnected_ShowNotification);
49 FRIEND_TEST_ALL_PREFIXES(HatsNotificationControllerTest,
50 DismissNotification_ShouldUpdatePref);
51
40 ~HatsNotificationController() override; 52 ~HatsNotificationController() override;
41 53
42 // NotificationDelegate overrides: 54 // NotificationDelegate overrides:
43 void Initialize(bool is_new_device); 55 void Initialize(bool is_new_device);
44 void ButtonClick(int button_index) override; 56 void ButtonClick(int button_index) override;
45 void Close(bool by_user) override; 57 void Close(bool by_user) override;
46 std::string id() const override; 58 std::string id() const override;
47 59
48 // NetworkPortalDetector::Observer override: 60 // NetworkPortalDetector::Observer override:
49 void OnPortalDetectionCompleted( 61 void OnPortalDetectionCompleted(
50 const NetworkState* network, 62 const NetworkState* network,
51 const NetworkPortalDetector::CaptivePortalState& state) override; 63 const NetworkPortalDetector::CaptivePortalState& state) override;
52 64
53 Notification* CreateNotification(); 65 Notification* CreateNotification();
54 void UpdateLastInteractionTime(); 66 void UpdateLastInteractionTime();
55 67
56 Profile* profile_; 68 Profile* profile_;
57 base::WeakPtrFactory<HatsNotificationController> weak_pointer_factory_; 69 base::WeakPtrFactory<HatsNotificationController> weak_pointer_factory_;
58 70
59 DISALLOW_COPY_AND_ASSIGN(HatsNotificationController); 71 DISALLOW_COPY_AND_ASSIGN(HatsNotificationController);
60 }; 72 };
61 73
62 } // namespace chromeos 74 } // namespace chromeos
63 75
64 #endif // CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_ 76 #endif // CHROME_BROWSER_CHROMEOS_HATS_HATS_NOTIFICATION_CONTROLLER_H_
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/chromeos/hats/hats_notification_controller_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698