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

Side by Side Diff: chrome/browser/ui/webui/help/version_updater_chromeos_unittest.cc

Issue 1086733002: Ensure tests have an active task runner (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Rebased. Created 5 years, 8 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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/ui/webui/help/version_updater_chromeos.h" 5 #include "chrome/browser/ui/webui/help/version_updater_chromeos.h"
6 6
7 #include "base/bind.h" 7 #include "base/bind.h"
8 #include "base/compiler_specific.h" 8 #include "base/compiler_specific.h"
9 #include "base/macros.h" 9 #include "base/macros.h"
10 #include "base/memory/scoped_ptr.h" 10 #include "base/memory/scoped_ptr.h"
11 #include "base/message_loop/message_loop.h"
12 #include "chrome/browser/chromeos/login/users/mock_user_manager.h" 11 #include "chrome/browser/chromeos/login/users/mock_user_manager.h"
13 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h" 12 #include "chrome/browser/chromeos/login/users/scoped_user_manager_enabler.h"
14 #include "chrome/browser/chromeos/settings/cros_settings.h" 13 #include "chrome/browser/chromeos/settings/cros_settings.h"
15 #include "chrome/browser/chromeos/settings/device_settings_service.h" 14 #include "chrome/browser/chromeos/settings/device_settings_service.h"
16 #include "chromeos/dbus/dbus_thread_manager.h" 15 #include "chromeos/dbus/dbus_thread_manager.h"
17 #include "chromeos/dbus/fake_update_engine_client.h" 16 #include "chromeos/dbus/fake_update_engine_client.h"
18 #include "chromeos/dbus/shill_service_client.h" 17 #include "chromeos/dbus/shill_service_client.h"
19 #include "chromeos/network/network_handler.h" 18 #include "chromeos/network/network_handler.h"
19 #include "content/public/test/test_browser_thread_bundle.h"
20 #include "testing/gmock/include/gmock/gmock.h" 20 #include "testing/gmock/include/gmock/gmock.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 #include "third_party/cros_system_api/dbus/service_constants.h" 22 #include "third_party/cros_system_api/dbus/service_constants.h"
23 23
24 using ::testing::AtLeast; 24 using ::testing::AtLeast;
25 using ::testing::Return; 25 using ::testing::Return;
26 26
27 namespace chromeos { 27 namespace chromeos {
28 28
29 namespace { 29 namespace {
(...skipping 30 matching lines...) Expand all
60 CrosSettings::Initialize(); 60 CrosSettings::Initialize();
61 61
62 NetworkHandler::Initialize(); 62 NetworkHandler::Initialize();
63 ShillServiceClient::TestInterface* service_test = 63 ShillServiceClient::TestInterface* service_test =
64 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface(); 64 DBusThreadManager::Get()->GetShillServiceClient()->GetTestInterface();
65 service_test->AddService("/service/eth", 65 service_test->AddService("/service/eth",
66 "eth" /* guid */, 66 "eth" /* guid */,
67 "eth", 67 "eth",
68 shill::kTypeEthernet, shill::kStateOnline, 68 shill::kTypeEthernet, shill::kStateOnline,
69 true /* visible */); 69 true /* visible */);
70 loop_.RunUntilIdle(); 70 base::MessageLoop::current()->RunUntilIdle();
71 } 71 }
72 72
73 void TearDown() override { 73 void TearDown() override {
74 NetworkHandler::Shutdown(); 74 NetworkHandler::Shutdown();
75 75
76 CrosSettings::Shutdown(); 76 CrosSettings::Shutdown();
77 DeviceSettingsService::Shutdown(); 77 DeviceSettingsService::Shutdown();
78 } 78 }
79 79
80 content::TestBrowserThreadBundle thread_bundle_;
80 scoped_ptr<VersionUpdater> version_updater_; 81 scoped_ptr<VersionUpdater> version_updater_;
81 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned. 82 FakeUpdateEngineClient* fake_update_engine_client_; // Not owned.
82 83
83 MockUserManager* mock_user_manager_; // Not owned. 84 MockUserManager* mock_user_manager_; // Not owned.
84 ScopedUserManagerEnabler user_manager_enabler_; 85 ScopedUserManagerEnabler user_manager_enabler_;
85 86
86 base::MessageLoop loop_;
87
88 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCrosTest); 87 DISALLOW_COPY_AND_ASSIGN(VersionUpdaterCrosTest);
89 }; 88 };
90 89
91 // The test checks following behaviour: 90 // The test checks following behaviour:
92 // 1. The device is currently on the dev channel and an user decides to switch 91 // 1. The device is currently on the dev channel and an user decides to switch
93 // to the beta channel. 92 // to the beta channel.
94 // 2. In the middle of channel switch the user decides to switch to the stable 93 // 2. In the middle of channel switch the user decides to switch to the stable
95 // channel. 94 // channel.
96 // 3. Update engine reports an error because downloading channel (beta) is not 95 // 3. Update engine reports an error because downloading channel (beta) is not
97 // equal 96 // equal
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
142 UpdateEngineClient::Status status; 141 UpdateEngineClient::Status status;
143 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE; 142 status.status = UpdateEngineClient::UPDATE_STATUS_IDLE;
144 fake_update_engine_client_->set_default_status(status); 143 fake_update_engine_client_->set_default_status(status);
145 fake_update_engine_client_->NotifyObserversThatStatusChanged(status); 144 fake_update_engine_client_->NotifyObserversThatStatusChanged(status);
146 } 145 }
147 146
148 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count()); 147 EXPECT_EQ(2, fake_update_engine_client_->request_update_check_call_count());
149 } 148 }
150 149
151 } // namespace chromeos 150 } // namespace chromeos
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698