| 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/chromeos/printer_detector/printer_detector.h" | 5 #include "chrome/browser/chromeos/printer_detector/printer_detector.h" |
| 6 | 6 |
| 7 #include "base/memory/scoped_ptr.h" | 7 #include "base/memory/scoped_ptr.h" |
| 8 #include "base/run_loop.h" | 8 #include "base/run_loop.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "base/strings/utf_string_conversions.h" | 10 #include "base/strings/utf_string_conversions.h" |
| (...skipping 85 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 96 protected: | 96 protected: |
| 97 void SetExtensionSystemReady(TestingProfile* profile) { | 97 void SetExtensionSystemReady(TestingProfile* profile) { |
| 98 extensions::TestExtensionSystem* test_extension_system = | 98 extensions::TestExtensionSystem* test_extension_system = |
| 99 static_cast<extensions::TestExtensionSystem*>( | 99 static_cast<extensions::TestExtensionSystem*>( |
| 100 extensions::ExtensionSystem::Get(profile)); | 100 extensions::ExtensionSystem::Get(profile)); |
| 101 test_extension_system->SetReady(); | 101 test_extension_system->SetReady(); |
| 102 base::RunLoop().RunUntilIdle(); | 102 base::RunLoop().RunUntilIdle(); |
| 103 } | 103 } |
| 104 | 104 |
| 105 void AddTestUser() { | 105 void AddTestUser() { |
| 106 const user_manager::User* user = user_manager_->AddUser(kTestUserId); | 106 const user_manager::User* user = |
| 107 user_manager_->AddUser(AccountId::FromUserEmail(kTestUserId)); |
| 107 profile_->set_profile_name(kTestUserId); | 108 profile_->set_profile_name(kTestUserId); |
| 108 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( | 109 chromeos::ProfileHelper::Get()->SetUserToProfileMappingForTesting( |
| 109 user, profile_.get()); | 110 user, profile_.get()); |
| 110 chromeos::PrinterDetectorFactory::GetInstance() | 111 chromeos::PrinterDetectorFactory::GetInstance() |
| 111 ->Get(profile_.get()) | 112 ->Get(profile_.get()) |
| 112 ->SetNotificationUIManagerForTesting(¬ification_ui_manager_); | 113 ->SetNotificationUIManagerForTesting(¬ification_ui_manager_); |
| 113 } | 114 } |
| 114 | 115 |
| 115 void InvokeUsbAdded(uint16 vendor_id, | 116 void InvokeUsbAdded(uint16 vendor_id, |
| 116 uint16 product_id, | 117 uint16 product_id, |
| (...skipping 212 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 329 .Set("interfaceClass", kPrinterInterfaceClass)))).Pass(); | 330 .Set("interfaceClass", kPrinterInterfaceClass)))).Pass(); |
| 330 ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) | 331 ASSERT_TRUE(extensions::ExtensionRegistry::Get(profile_.get()) |
| 331 ->AddEnabled(extension)); | 332 ->AddEnabled(extension)); |
| 332 | 333 |
| 333 InvokeUsbAdded(123, 456, 1); | 334 InvokeUsbAdded(123, 456, 1); |
| 334 | 335 |
| 335 ASSERT_EQ(0u, notification_ui_manager_.GetNotificationCount()); | 336 ASSERT_EQ(0u, notification_ui_manager_.GetNotificationCount()); |
| 336 } | 337 } |
| 337 | 338 |
| 338 } // namespace chromeos | 339 } // namespace chromeos |
| OLD | NEW |