| OLD | NEW |
| 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> |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/location.h" | 13 #include "base/location.h" |
| 14 #include "base/message_loop/message_loop.h" | 14 #include "base/message_loop/message_loop.h" |
| 15 #include "base/run_loop.h" | 15 #include "base/run_loop.h" |
| 16 #include "base/single_thread_task_runner.h" | 16 #include "base/single_thread_task_runner.h" |
| 17 #include "base/threading/thread_task_runner_handle.h" | 17 #include "base/threading/thread_task_runner_handle.h" |
| 18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" | 18 #include "chrome/browser/printing/cloud_print/cloud_print_proxy_service_factory.
h" |
| 19 #include "chrome/browser/service_process/service_process_control.h" | 19 #include "chrome/browser/service_process/service_process_control.h" |
| 20 #include "chrome/browser/ui/startup/startup_browser_creator.h" | 20 #include "chrome/browser/ui/startup/startup_browser_creator.h" |
| 21 #include "chrome/common/chrome_switches.h" | 21 #include "chrome/common/chrome_switches.h" |
| 22 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" | 22 #include "chrome/common/cloud_print/cloud_print_proxy_info.h" |
| 23 #include "chrome/common/pref_names.h" | 23 #include "chrome/common/pref_names.h" |
| 24 #include "chrome/common/service_messages.h" | 24 #include "chrome/common/service_messages.h" |
| 25 #include "chrome/test/base/testing_browser_process.h" | 25 #include "chrome/test/base/testing_browser_process.h" |
| 26 #include "chrome/test/base/testing_profile.h" | 26 #include "chrome/test/base/testing_profile.h" |
| 27 #include "chrome/test/base/testing_profile_manager.h" | 27 #include "chrome/test/base/testing_profile_manager.h" |
| 28 #include "components/prefs/testing_pref_service.h" | 28 #include "components/prefs/testing_pref_service.h" |
| 29 #include "components/syncable_prefs/testing_pref_service_syncable.h" | 29 #include "components/sync_preferences/testing_pref_service_syncable.h" |
| 30 #include "content/public/browser/browser_thread.h" | 30 #include "content/public/browser/browser_thread.h" |
| 31 #include "content/public/test/test_browser_thread.h" | 31 #include "content/public/test/test_browser_thread.h" |
| 32 #include "testing/gmock/include/gmock/gmock.h" | 32 #include "testing/gmock/include/gmock/gmock.h" |
| 33 #include "testing/gtest/include/gtest/gtest.h" | 33 #include "testing/gtest/include/gtest/gtest.h" |
| 34 | 34 |
| 35 using ::testing::Assign; | 35 using ::testing::Assign; |
| 36 using ::testing::AtMost; | 36 using ::testing::AtMost; |
| 37 using ::testing::DeleteArg; | 37 using ::testing::DeleteArg; |
| 38 using ::testing::DoAll; | 38 using ::testing::DoAll; |
| 39 using ::testing::Invoke; | 39 using ::testing::Invoke; |
| (...skipping 195 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 235 mock_control.Disconnect(); | 235 mock_control.Disconnect(); |
| 236 EXPECT_FALSE(mock_control.IsConnected()); | 236 EXPECT_FALSE(mock_control.IsConnected()); |
| 237 } | 237 } |
| 238 | 238 |
| 239 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabled) { | 239 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyDisabled) { |
| 240 TestCloudPrintProxyService service(&profile_); | 240 TestCloudPrintProxyService service(&profile_); |
| 241 | 241 |
| 242 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( | 242 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( |
| 243 MockServiceProcessControl::kServiceStateDisabled, false); | 243 MockServiceProcessControl::kServiceStateDisabled, false); |
| 244 | 244 |
| 245 syncable_prefs::TestingPrefServiceSyncable* prefs = | 245 sync_preferences::TestingPrefServiceSyncable* prefs = |
| 246 profile_.GetTestingPrefService(); | 246 profile_.GetTestingPrefService(); |
| 247 prefs->SetUserPref( | 247 prefs->SetUserPref( |
| 248 prefs::kCloudPrintEmail, | 248 prefs::kCloudPrintEmail, |
| 249 new base::StringValue(MockServiceProcessControl::EnabledUserId())); | 249 new base::StringValue(MockServiceProcessControl::EnabledUserId())); |
| 250 | 250 |
| 251 service.Initialize(); | 251 service.Initialize(); |
| 252 | 252 |
| 253 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); | 253 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); |
| 254 } | 254 } |
| 255 | 255 |
| 256 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabled) { | 256 TEST_F(CloudPrintProxyPolicyTest, StartWithNoPolicyProxyEnabled) { |
| 257 TestCloudPrintProxyService service(&profile_); | 257 TestCloudPrintProxyService service(&profile_); |
| 258 | 258 |
| 259 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( | 259 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( |
| 260 MockServiceProcessControl::kServiceStateEnabled, false); | 260 MockServiceProcessControl::kServiceStateEnabled, false); |
| 261 | 261 |
| 262 syncable_prefs::TestingPrefServiceSyncable* prefs = | 262 sync_preferences::TestingPrefServiceSyncable* prefs = |
| 263 profile_.GetTestingPrefService(); | 263 profile_.GetTestingPrefService(); |
| 264 prefs->SetUserPref(prefs::kCloudPrintEmail, | 264 prefs->SetUserPref(prefs::kCloudPrintEmail, |
| 265 new base::StringValue(std::string())); | 265 new base::StringValue(std::string())); |
| 266 | 266 |
| 267 service.Initialize(); | 267 service.Initialize(); |
| 268 service.RefreshStatusFromService(); | 268 service.RefreshStatusFromService(); |
| 269 | 269 |
| 270 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), | 270 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), |
| 271 prefs->GetString(prefs::kCloudPrintEmail)); | 271 prefs->GetString(prefs::kCloudPrintEmail)); |
| 272 } | 272 } |
| 273 | 273 |
| 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 syncable_prefs::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::FundamentalValue(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 syncable_prefs::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::FundamentalValue(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 syncable_prefs::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::FundamentalValue(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 syncable_prefs::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::FundamentalValue(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 syncable_prefs::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::FundamentalValue(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 syncable_prefs::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::FundamentalValue(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_); |
| 402 | 402 |
| 403 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( | 403 service.GetMockServiceProcessControl()->SetConnectSuccessMockExpectations( |
| 404 MockServiceProcessControl::kServiceStateDisabled, false); | 404 MockServiceProcessControl::kServiceStateDisabled, false); |
| 405 | 405 |
| 406 syncable_prefs::TestingPrefServiceSyncable* prefs = | 406 sync_preferences::TestingPrefServiceSyncable* prefs = |
| 407 profile_.GetTestingPrefService(); | 407 profile_.GetTestingPrefService(); |
| 408 prefs->SetUserPref( | 408 prefs->SetUserPref( |
| 409 prefs::kCloudPrintEmail, | 409 prefs::kCloudPrintEmail, |
| 410 new base::StringValue(MockServiceProcessControl::EnabledUserId())); | 410 new base::StringValue(MockServiceProcessControl::EnabledUserId())); |
| 411 | 411 |
| 412 service.Initialize(); | 412 service.Initialize(); |
| 413 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); | 413 EXPECT_EQ(std::string(), prefs->GetString(prefs::kCloudPrintEmail)); |
| 414 | 414 |
| 415 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); | 415 service.GetMockServiceProcessControl()->SetWillBeEnabledExpectations(); |
| 416 service.EnableForUser(); | 416 service.EnableForUser(); |
| 417 | 417 |
| 418 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), | 418 EXPECT_EQ(MockServiceProcessControl::EnabledUserId(), |
| 419 prefs->GetString(prefs::kCloudPrintEmail)); | 419 prefs->GetString(prefs::kCloudPrintEmail)); |
| 420 } | 420 } |
| 421 | 421 |
| 422 TEST_F(CloudPrintProxyPolicyTest, | 422 TEST_F(CloudPrintProxyPolicyTest, |
| 423 StartWithPolicySetProxyEnabledThenClearPolicyAndEnable) { | 423 StartWithPolicySetProxyEnabledThenClearPolicyAndEnable) { |
| 424 TestCloudPrintProxyService service(&profile_); | 424 TestCloudPrintProxyService service(&profile_); |
| 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 syncable_prefs::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::FundamentalValue(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 } |
| OLD | NEW |