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

Side by Side Diff: chrome/browser/printing/cloud_print/cloud_print_proxy_service_unittest.cc

Issue 2666093002: Remove base::FundamentalValue (Closed)
Patch Set: Rebase Created 3 years, 9 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) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h" 5 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <string> 10 #include <string>
(...skipping 263 matching lines...) Expand 10 before | Expand all | Expand 10 after
274 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyDisabled) { 274 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyDisabled) {
275 TestCloudPrintProxyService service(&profile_); 275 TestCloudPrintProxyService service(&profile_);
276 276
277 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 277 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
278 MockServiceProcessControl::kServiceStateDisabled, false); 278 MockServiceProcessControl::kServiceStateDisabled, false);
279 279
280 sync_preferences::TestingPrefServiceSyncable* prefs = 280 sync_preferences::TestingPrefServiceSyncable* prefs =
281 profile_.GetTestingPrefService(); 281 profile_.GetTestingPrefService();
282 prefs->SetUserPref(prefs::kCloudPrintEmail, 282 prefs->SetUserPref(prefs::kCloudPrintEmail,
283 new base::StringValue(std::string())); 283 new base::StringValue(std::string()));
284 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 284 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
285 new base::FundamentalValue(false));
286 285
287 service.Initialize(); 286 service.Initialize();
288 287
289 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 288 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
290 } 289 }
291 290
292 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyEnabled) { 291 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyEnabled) {
293 TestCloudPrintProxyService service(&profile_); 292 TestCloudPrintProxyService service(&profile_);
294 293
295 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 294 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
296 MockServiceProcessControl::kServiceStateEnabled, false); 295 MockServiceProcessControl::kServiceStateEnabled, false);
297 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 296 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
298 297
299 sync_preferences::TestingPrefServiceSyncable* prefs = 298 sync_preferences::TestingPrefServiceSyncable* prefs =
300 profile_.GetTestingPrefService(); 299 profile_.GetTestingPrefService();
301 prefs->SetUserPref(prefs::kCloudPrintEmail, 300 prefs->SetUserPref(prefs::kCloudPrintEmail,
302 new base::StringValue(std::string())); 301 new base::StringValue(std::string()));
303 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 302 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
304 new base::FundamentalValue(false));
305 303
306 service.Initialize(); 304 service.Initialize();
307 305
308 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 306 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
309 } 307 }
310 308
311 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenSetPolicy) { 309 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenSetPolicy) {
312 TestCloudPrintProxyService service(&profile_); 310 TestCloudPrintProxyService service(&profile_);
313 311
314 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 312 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
315 MockServiceProcessControl::kServiceStateDisabled, false); 313 MockServiceProcessControl::kServiceStateDisabled, false);
316 314
317 sync_preferences::TestingPrefServiceSyncable* prefs = 315 sync_preferences::TestingPrefServiceSyncable* prefs =
318 profile_.GetTestingPrefService(); 316 profile_.GetTestingPrefService();
319 prefs->SetUserPref( 317 prefs->SetUserPref(
320 prefs::kCloudPrintEmail, 318 prefs::kCloudPrintEmail,
321 new base::StringValue(MockServiceProcessControl::EnabledUserId())); 319 new base::StringValue(MockServiceProcessControl::EnabledUserId()));
322 320
323 service.Initialize(); 321 service.Initialize();
324 322
325 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 323 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
326 324
327 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 325 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
328 new base::FundamentalValue(false));
329 326
330 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 327 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
331 } 328 }
332 329
333 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabledThenSetPolicy) { 330 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabledThenSetPolicy) {
334 TestCloudPrintProxyService service(&profile_); 331 TestCloudPrintProxyService service(&profile_);
335 332
336 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 333 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
337 MockServiceProcessControl::kServiceStateEnabled, false); 334 MockServiceProcessControl::kServiceStateEnabled, false);
338 335
339 sync_preferences::TestingPrefServiceSyncable* prefs = 336 sync_preferences::TestingPrefServiceSyncable* prefs =
340 profile_.GetTestingPrefService(); 337 profile_.GetTestingPrefService();
341 prefs->SetUserPref(prefs::kCloudPrintEmail, 338 prefs->SetUserPref(prefs::kCloudPrintEmail,
342 new base::StringValue(std::string())); 339 new base::StringValue(std::string()));
343 340
344 service.Initialize(); 341 service.Initialize();
345 service.RefreshStatusFromService(); 342 service.RefreshStatusFromService();
346 343
347 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 344 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
348 prefs->GetString(prefs::kCloudPrintEmail)); 345 prefs->GetString(prefs::kCloudPrintEmail));
349 346
350 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 347 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
351 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 348 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
352 new base::FundamentalValue(false));
353 349
354 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 350 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
355 } 351 }
356 352
357 TEST_F(CloudPrintProxyPolicyTest, 353 TEST_F(CloudPrintProxyPolicyTest,
358 StartWithPolicySetProxyDisabledThenClearPolicy) { 354 StartWithPolicySetProxyDisabledThenClearPolicy) {
359 TestCloudPrintProxyService service(&profile_); 355 TestCloudPrintProxyService service(&profile_);
360 356
361 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 357 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
362 MockServiceProcessControl::kServiceStateDisabled, false); 358 MockServiceProcessControl::kServiceStateDisabled, false);
363 359
364 sync_preferences::TestingPrefServiceSyncable* prefs = 360 sync_preferences::TestingPrefServiceSyncable* prefs =
365 profile_.GetTestingPrefService(); 361 profile_.GetTestingPrefService();
366 prefs->SetUserPref(prefs::kCloudPrintEmail, 362 prefs->SetUserPref(prefs::kCloudPrintEmail,
367 new base::StringValue(std::string())); 363 new base::StringValue(std::string()));
368 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 364 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
369 new base::FundamentalValue(false));
370 365
371 service.Initialize(); 366 service.Initialize();
372 367
373 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 368 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
374 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 369 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
375 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 370 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
376 } 371 }
377 372
378 TEST_F(CloudPrintProxyPolicyTest, 373 TEST_F(CloudPrintProxyPolicyTest,
379 StartWithPolicySetProxyEnabledThenClearPolicy) { 374 StartWithPolicySetProxyEnabledThenClearPolicy) {
380 TestCloudPrintProxyService service(&profile_); 375 TestCloudPrintProxyService service(&profile_);
381 376
382 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 377 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
383 MockServiceProcessControl::kServiceStateEnabled, false); 378 MockServiceProcessControl::kServiceStateEnabled, false);
384 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 379 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
385 380
386 sync_preferences::TestingPrefServiceSyncable* prefs = 381 sync_preferences::TestingPrefServiceSyncable* prefs =
387 profile_.GetTestingPrefService(); 382 profile_.GetTestingPrefService();
388 prefs->SetUserPref(prefs::kCloudPrintEmail, 383 prefs->SetUserPref(prefs::kCloudPrintEmail,
389 new base::StringValue(std::string())); 384 new base::StringValue(std::string()));
390 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 385 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
391 new base::FundamentalValue(false));
392 386
393 service.Initialize(); 387 service.Initialize();
394 388
395 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 389 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
396 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 390 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
397 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 391 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
398 } 392 }
399 393
400 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenEnable) { 394 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenEnable) {
401 TestCloudPrintProxyService service(&profile_); 395 TestCloudPrintProxyService service(&profile_);
(...skipping 22 matching lines...) Expand all
424 TestCloudPrintProxyService service(&profile_); 418 TestCloudPrintProxyService service(&profile_);
425 419
426 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 420 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
427 MockServiceProcessControl::kServiceStateEnabled, false); 421 MockServiceProcessControl::kServiceStateEnabled, false);
428 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 422 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
429 423
430 sync_preferences::TestingPrefServiceSyncable* prefs = 424 sync_preferences::TestingPrefServiceSyncable* prefs =
431 profile_.GetTestingPrefService(); 425 profile_.GetTestingPrefService();
432 prefs->SetUserPref(prefs::kCloudPrintEmail, 426 prefs->SetUserPref(prefs::kCloudPrintEmail,
433 new base::StringValue(std::string())); 427 new base::StringValue(std::string()));
434 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 428 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, new base::Value(false));
435 new base::FundamentalValue(false));
436 429
437 service.Initialize(); 430 service.Initialize();
438 431
439 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 432 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
440 service.EnableForUser(); 433 service.EnableForUser();
441 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 434 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
442 435
443 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 436 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
444 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 437 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
445 438
446 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); 439 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations();
447 service.EnableForUser(); 440 service.EnableForUser();
448 441
449 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 442 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
450 prefs->GetString(prefs::kCloudPrintEmail)); 443 prefs->GetString(prefs::kCloudPrintEmail));
451 } 444 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698