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

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

Issue 2476493003: Remove FundamentalValue
Patch Set: Fix Created 4 years, 1 month 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 264 matching lines...) Expand 10 before | Expand all | Expand 10 after
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,
285 new base::FundamentalValue(false)); 285 new base::Value(false));
286 286
287 service.Initialize(); 287 service.Initialize();
288 288
289 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 289 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
290 } 290 }
291 291
292 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyEnabled) { 292 TEST_F(CloudPrintProxyPolicyTest, StartWithPolicySetProxyEnabled) {
293 TestCloudPrintProxyService service(&profile_); 293 TestCloudPrintProxyService service(&profile_);
294 294
295 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 295 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
296 MockServiceProcessControl::kServiceStateEnabled, false); 296 MockServiceProcessControl::kServiceStateEnabled, false);
297 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 297 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
298 298
299 sync_preferences::TestingPrefServiceSyncable* prefs = 299 sync_preferences::TestingPrefServiceSyncable* prefs =
300 profile_.GetTestingPrefService(); 300 profile_.GetTestingPrefService();
301 prefs->SetUserPref(prefs::kCloudPrintEmail, 301 prefs->SetUserPref(prefs::kCloudPrintEmail,
302 new base::StringValue(std::string())); 302 new base::StringValue(std::string()));
303 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 303 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
304 new base::FundamentalValue(false)); 304 new base::Value(false));
305 305
306 service.Initialize(); 306 service.Initialize();
307 307
308 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 308 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
309 } 309 }
310 310
311 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenSetPolicy) { 311 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenSetPolicy) {
312 TestCloudPrintProxyService service(&profile_); 312 TestCloudPrintProxyService service(&profile_);
313 313
314 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 314 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
315 MockServiceProcessControl::kServiceStateDisabled, false); 315 MockServiceProcessControl::kServiceStateDisabled, false);
316 316
317 sync_preferences::TestingPrefServiceSyncable* prefs = 317 sync_preferences::TestingPrefServiceSyncable* prefs =
318 profile_.GetTestingPrefService(); 318 profile_.GetTestingPrefService();
319 prefs->SetUserPref( 319 prefs->SetUserPref(
320 prefs::kCloudPrintEmail, 320 prefs::kCloudPrintEmail,
321 new base::StringValue(MockServiceProcessControl::EnabledUserId())); 321 new base::StringValue(MockServiceProcessControl::EnabledUserId()));
322 322
323 service.Initialize(); 323 service.Initialize();
324 324
325 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 325 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
326 326
327 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 327 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
328 new base::FundamentalValue(false)); 328 new base::Value(false));
329 329
330 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 330 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
331 } 331 }
332 332
333 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabledThenSetPolicy) { 333 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabledThenSetPolicy) {
334 TestCloudPrintProxyService service(&profile_); 334 TestCloudPrintProxyService service(&profile_);
335 335
336 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 336 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
337 MockServiceProcessControl::kServiceStateEnabled, false); 337 MockServiceProcessControl::kServiceStateEnabled, false);
338 338
339 sync_preferences::TestingPrefServiceSyncable* prefs = 339 sync_preferences::TestingPrefServiceSyncable* prefs =
340 profile_.GetTestingPrefService(); 340 profile_.GetTestingPrefService();
341 prefs->SetUserPref(prefs::kCloudPrintEmail, 341 prefs->SetUserPref(prefs::kCloudPrintEmail,
342 new base::StringValue(std::string())); 342 new base::StringValue(std::string()));
343 343
344 service.Initialize(); 344 service.Initialize();
345 service.RefreshStatusFromService(); 345 service.RefreshStatusFromService();
346 346
347 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 347 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
348 prefs->GetString(prefs::kCloudPrintEmail)); 348 prefs->GetString(prefs::kCloudPrintEmail));
349 349
350 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 350 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
351 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 351 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
352 new base::FundamentalValue(false)); 352 new base::Value(false));
353 353
354 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 354 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
355 } 355 }
356 356
357 TEST_F(CloudPrintProxyPolicyTest, 357 TEST_F(CloudPrintProxyPolicyTest,
358 StartWithPolicySetProxyDisabledThenClearPolicy) { 358 StartWithPolicySetProxyDisabledThenClearPolicy) {
359 TestCloudPrintProxyService service(&profile_); 359 TestCloudPrintProxyService service(&profile_);
360 360
361 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 361 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
362 MockServiceProcessControl::kServiceStateDisabled, false); 362 MockServiceProcessControl::kServiceStateDisabled, false);
363 363
364 sync_preferences::TestingPrefServiceSyncable* prefs = 364 sync_preferences::TestingPrefServiceSyncable* prefs =
365 profile_.GetTestingPrefService(); 365 profile_.GetTestingPrefService();
366 prefs->SetUserPref(prefs::kCloudPrintEmail, 366 prefs->SetUserPref(prefs::kCloudPrintEmail,
367 new base::StringValue(std::string())); 367 new base::StringValue(std::string()));
368 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 368 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
369 new base::FundamentalValue(false)); 369 new base::Value(false));
370 370
371 service.Initialize(); 371 service.Initialize();
372 372
373 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 373 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
374 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 374 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
375 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 375 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
376 } 376 }
377 377
378 TEST_F(CloudPrintProxyPolicyTest, 378 TEST_F(CloudPrintProxyPolicyTest,
379 StartWithPolicySetProxyEnabledThenClearPolicy) { 379 StartWithPolicySetProxyEnabledThenClearPolicy) {
380 TestCloudPrintProxyService service(&profile_); 380 TestCloudPrintProxyService service(&profile_);
381 381
382 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 382 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
383 MockServiceProcessControl::kServiceStateEnabled, false); 383 MockServiceProcessControl::kServiceStateEnabled, false);
384 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 384 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
385 385
386 sync_preferences::TestingPrefServiceSyncable* prefs = 386 sync_preferences::TestingPrefServiceSyncable* prefs =
387 profile_.GetTestingPrefService(); 387 profile_.GetTestingPrefService();
388 prefs->SetUserPref(prefs::kCloudPrintEmail, 388 prefs->SetUserPref(prefs::kCloudPrintEmail,
389 new base::StringValue(std::string())); 389 new base::StringValue(std::string()));
390 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 390 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
391 new base::FundamentalValue(false)); 391 new base::Value(false));
392 392
393 service.Initialize(); 393 service.Initialize();
394 394
395 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 395 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
396 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 396 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
397 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 397 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
398 } 398 }
399 399
400 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenEnable) { 400 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabledThenEnable) {
401 TestCloudPrintProxyService service(&profile_); 401 TestCloudPrintProxyService service(&profile_);
(...skipping 23 matching lines...) Expand all
425 425
426 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( 426 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations(
427 MockServiceProcessControl::kServiceStateEnabled, false); 427 MockServiceProcessControl::kServiceStateEnabled, false);
428 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations(); 428 service.GetMockServiceProcessControl()->SetWillBeDisabledExpectations();
429 429
430 sync_preferences::TestingPrefServiceSyncable* prefs = 430 sync_preferences::TestingPrefServiceSyncable* prefs =
431 profile_.GetTestingPrefService(); 431 profile_.GetTestingPrefService();
432 prefs->SetUserPref(prefs::kCloudPrintEmail, 432 prefs->SetUserPref(prefs::kCloudPrintEmail,
433 new base::StringValue(std::string())); 433 new base::StringValue(std::string()));
434 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled, 434 prefs->SetManagedPref(prefs::kCloudPrintProxyEnabled,
435 new base::FundamentalValue(false)); 435 new base::Value(false));
436 436
437 service.Initialize(); 437 service.Initialize();
438 438
439 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 439 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
440 service.EnableForUser(); 440 service.EnableForUser();
441 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 441 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
442 442
443 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled); 443 prefs->RemoveManagedPref(prefs::kCloudPrintProxyEnabled);
444 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); 444 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail));
445 445
446 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); 446 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations();
447 service.EnableForUser(); 447 service.EnableForUser();
448 448
449 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), 449 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(),
450 prefs->GetString(prefs::kCloudPrintEmail)); 450 prefs->GetString(prefs::kCloudPrintEmail));
451 } 451 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698