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

Side by Side Diff: chrome/browser/web_resource/resource_request_allowed_notifier_unittest.cc

Issue 15949022: Translate: language list smart updater (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: typo Created 7 years, 6 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 | Annotate | Revision Log
OLDNEW
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 #include "base/prefs/testing_pref_service.h" 5 #include "base/prefs/testing_pref_service.h"
6 #include "chrome/browser/web_resource/eula_accepted_notifier.h" 6 #include "chrome/browser/web_resource/eula_accepted_notifier.h"
7 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h" 7 #include "chrome/browser/web_resource/resource_request_allowed_notifier_test_uti l.h"
8 #include "chrome/common/chrome_notification_types.h" 8 #include "chrome/common/chrome_notification_types.h"
9 #include "chrome/test/base/testing_browser_process.h" 9 #include "chrome/test/base/testing_browser_process.h"
10 #include "content/public/browser/notification_service.h" 10 #include "content/public/browser/notification_service.h"
(...skipping 173 matching lines...) Expand 10 before | Expand all | Expand 10 after
184 net::NetworkChangeNotifier::CONNECTION_3G); 184 net::NetworkChangeNotifier::CONNECTION_3G);
185 EXPECT_FALSE(was_notified()); 185 EXPECT_FALSE(was_notified());
186 SimulateNetworkConnectionChange( 186 SimulateNetworkConnectionChange(
187 net::NetworkChangeNotifier::CONNECTION_4G); 187 net::NetworkChangeNotifier::CONNECTION_4G);
188 EXPECT_FALSE(was_notified()); 188 EXPECT_FALSE(was_notified());
189 SimulateNetworkConnectionChange( 189 SimulateNetworkConnectionChange(
190 net::NetworkChangeNotifier::CONNECTION_WIFI); 190 net::NetworkChangeNotifier::CONNECTION_WIFI);
191 EXPECT_FALSE(was_notified()); 191 EXPECT_FALSE(was_notified());
192 } 192 }
193 193
194 TEST_F(ResourceRequestAllowedNotifierTest, NoNotifyOnFlakyConnection) { 194 TEST_F(ResourceRequestAllowedNotifierTest, NoNotifyOnFlakyConnection) {
Alexei Svitkine (slow) 2013/06/12 14:50:14 Why did you remove lines from this test?
Takashi Toyoshima 2013/06/14 08:13:55 Because this test looks wrong. 1) network goes on
195 SimulateResourceRequest(); 195 SimulateResourceRequest();
196 SetWaitingForNetwork(false); 196 SetWaitingForNetwork(false);
197 SimulateNetworkConnectionChange( 197 SimulateNetworkConnectionChange(
198 net::NetworkChangeNotifier::CONNECTION_WIFI); 198 net::NetworkChangeNotifier::CONNECTION_WIFI);
199 EXPECT_FALSE(was_notified()); 199 EXPECT_FALSE(was_notified());
200 SimulateNetworkConnectionChange( 200 SimulateNetworkConnectionChange(
201 net::NetworkChangeNotifier::CONNECTION_NONE);
202 EXPECT_FALSE(was_notified());
203 SimulateNetworkConnectionChange(
204 net::NetworkChangeNotifier::CONNECTION_WIFI); 201 net::NetworkChangeNotifier::CONNECTION_WIFI);
205 EXPECT_FALSE(was_notified()); 202 EXPECT_FALSE(was_notified());
206 } 203 }
207 204
205 TEST_F(ResourceRequestAllowedNotifierTest, NoNotifyOnEulaAfterGoOffline) {
206 SimulateResourceRequest();
207 DisableEulaAndNetwork();
208
209 SimulateNetworkConnectionChange(
210 net::NetworkChangeNotifier::CONNECTION_WIFI);
211 EXPECT_FALSE(was_notified());
212 SimulateNetworkConnectionChange(
213 net::NetworkChangeNotifier::CONNECTION_NONE);
214 EXPECT_FALSE(was_notified());
215 SimulateEulaAccepted();
216 EXPECT_FALSE(was_notified());
217 }
218
208 TEST_F(ResourceRequestAllowedNotifierTest, NoRequestNoNotify) { 219 TEST_F(ResourceRequestAllowedNotifierTest, NoRequestNoNotify) {
209 // Ensure that if the observing service does not request access, it does not 220 // Ensure that if the observing service does not request access, it does not
210 // get notified, even if the criteria is met. Note that this is done by not 221 // get notified, even if the criteria is met. Note that this is done by not
211 // calling SimulateResourceRequest here. 222 // calling SimulateResourceRequest here.
212 SetWaitingForNetwork(true); 223 SetWaitingForNetwork(true);
213 SimulateNetworkConnectionChange( 224 SimulateNetworkConnectionChange(
214 net::NetworkChangeNotifier::CONNECTION_ETHERNET); 225 net::NetworkChangeNotifier::CONNECTION_ETHERNET);
215 EXPECT_FALSE(was_notified()); 226 EXPECT_FALSE(was_notified());
216 } 227 }
217 228
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after
253 // calling SimulateResourceRequest here. 264 // calling SimulateResourceRequest here.
254 DisableEulaAndNetwork(); 265 DisableEulaAndNetwork();
255 266
256 SimulateNetworkConnectionChange( 267 SimulateNetworkConnectionChange(
257 net::NetworkChangeNotifier::CONNECTION_WIFI); 268 net::NetworkChangeNotifier::CONNECTION_WIFI);
258 EXPECT_FALSE(was_notified()); 269 EXPECT_FALSE(was_notified());
259 270
260 SimulateEulaAccepted(); 271 SimulateEulaAccepted();
261 EXPECT_FALSE(was_notified()); 272 EXPECT_FALSE(was_notified());
262 } 273 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698