| OLD | NEW |
| (Empty) | |
| 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 2 // Use of this source code is governed by a BSD-style license that can be |
| 3 // found in the LICENSE file. |
| 4 |
| 5 #include "chrome/browser/chromeos/dbus/mock_dbus_thread_manager.h" |
| 6 #include "chrome/browser/chromeos/dbus/mock_update_engine_client.h" |
| 7 #include "chrome/browser/extensions/extension_apitest.h" |
| 8 |
| 9 using chromeos::UpdateEngineClient; |
| 10 using ::testing::Return; |
| 11 |
| 12 class AccessibilityPrivateApiTest : public ExtensionApiTest { |
| 13 public: |
| 14 AccessibilityPrivateApiTest() : mock_update_engine_client_(NULL) {} |
| 15 |
| 16 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE { |
| 17 ExtensionApiTest::SetUpInProcessBrowserTestFixture(); |
| 18 chromeos::MockDBusThreadManager* mock_dbus_thread_manager = |
| 19 new chromeos::MockDBusThreadManager; |
| 20 chromeos::DBusThreadManager::InitializeForTesting(mock_dbus_thread_manager); |
| 21 mock_update_engine_client_ = |
| 22 mock_dbus_thread_manager->mock_update_engine_client(); |
| 23 } |
| 24 |
| 25 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE { |
| 26 chromeos::DBusThreadManager::Shutdown(); |
| 27 ExtensionApiTest::TearDownInProcessBrowserTestFixture(); |
| 28 } |
| 29 |
| 30 protected: |
| 31 chromeos::MockUpdateEngineClient* mock_update_engine_client_; |
| 32 |
| 33 private: |
| 34 DISALLOW_COPY_AND_ASSIGN(AccessibilityPrivateApiTest); |
| 35 }; |
| 36 |
| 37 IN_PROC_BROWSER_TEST_F(AccessibilityPrivateApiTest, GetUpdateStatus) { |
| 38 UpdateEngineClient::Status status_not_available; |
| 39 status_not_available.status = UpdateEngineClient::UPDATE_STATUS_IDLE; |
| 40 UpdateEngineClient::Status status_updating; |
| 41 status_updating.status = UpdateEngineClient::UPDATE_STATUS_DOWNLOADING; |
| 42 status_updating.download_progress = 0.5; |
| 43 UpdateEngineClient::Status status_boot_needed; |
| 44 status_boot_needed.status = |
| 45 UpdateEngineClient::UPDATE_STATUS_UPDATED_NEED_REBOOT; |
| 46 |
| 47 EXPECT_CALL(*mock_update_engine_client_, GetLastStatus()) |
| 48 .WillOnce(Return(status_not_available)) |
| 49 .WillOnce(Return(status_updating)) |
| 50 .WillOnce(Return(status_boot_needed)); |
| 51 ASSERT_TRUE(RunComponentExtensionTest( |
| 52 "accessibility_private/get_update_status")) << message_; |
| 53 } |
| OLD | NEW |