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

Side by Side Diff: ash/display/projecting_observer_chromeos_unittest.cc

Issue 477663004: Merged FakedDBusThreadManager with DBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 6 years, 3 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 | Annotate | Revision Log
« no previous file with comments | « no previous file | ash/system/chromeos/network/network_state_notifier_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ash/display/projecting_observer_chromeos.h" 5 #include "ash/display/projecting_observer_chromeos.h"
6 6
7 #include "base/memory/scoped_vector.h" 7 #include "base/memory/scoped_vector.h"
8 #include "chromeos/dbus/fake_dbus_thread_manager.h" 8 #include "chromeos/dbus/dbus_thread_manager.h"
9 #include "chromeos/dbus/fake_power_manager_client.h" 9 #include "chromeos/dbus/fake_power_manager_client.h"
10 #include "testing/gtest/include/gtest/gtest.h" 10 #include "testing/gtest/include/gtest/gtest.h"
11 #include "ui/display/chromeos/test/test_display_snapshot.h" 11 #include "ui/display/chromeos/test/test_display_snapshot.h"
12 12
13 namespace ash { 13 namespace ash {
14 namespace { 14 namespace {
15 15
16 ui::TestDisplaySnapshot* CreateInternalSnapshot() { 16 ui::TestDisplaySnapshot* CreateInternalSnapshot() {
17 ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot(); 17 ui::TestDisplaySnapshot* output = new ui::TestDisplaySnapshot();
18 output->set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL); 18 output->set_type(ui::DISPLAY_CONNECTION_TYPE_INTERNAL);
(...skipping 14 matching lines...) Expand all
33 state.display = displays[i]; 33 state.display = displays[i];
34 outputs.push_back(state); 34 outputs.push_back(state);
35 } 35 }
36 36
37 return outputs; 37 return outputs;
38 } 38 }
39 39
40 class ProjectingObserverTest : public testing::Test { 40 class ProjectingObserverTest : public testing::Test {
41 public: 41 public:
42 ProjectingObserverTest() : observer_(new ProjectingObserver()) { 42 ProjectingObserverTest() : observer_(new ProjectingObserver()) {
43 chromeos::FakeDBusThreadManager* dbus_manager =
44 new chromeos::FakeDBusThreadManager();
45 fake_power_client_ = new chromeos::FakePowerManagerClient(); 43 fake_power_client_ = new chromeos::FakePowerManagerClient();
46 44
47 dbus_manager->SetPowerManagerClient( 45 chromeos::DBusThreadManager::GetSetterForTesting()->SetPowerManagerClient(
48 scoped_ptr<chromeos::PowerManagerClient>(fake_power_client_)); 46 scoped_ptr<chromeos::PowerManagerClient>(fake_power_client_));
49
50 // Takes ownership of |dbus_manager|.
51 chromeos::DBusThreadManager::InitializeForTesting(dbus_manager);
52 } 47 }
53 48
54 virtual ~ProjectingObserverTest() { 49 virtual ~ProjectingObserverTest() {
55 chromeos::DBusThreadManager::Shutdown(); 50 chromeos::DBusThreadManager::Shutdown();
56 } 51 }
57 52
58 protected: 53 protected:
59 scoped_ptr<ProjectingObserver> observer_; 54 scoped_ptr<ProjectingObserver> observer_;
60 chromeos::FakePowerManagerClient* fake_power_client_; // Not owned. 55 chromeos::FakePowerManagerClient* fake_power_client_; // Not owned.
61 56
(...skipping 121 matching lines...) Expand 10 before | Expand all | Expand 10 after
183 178
184 // Remove VGA output. 179 // Remove VGA output.
185 outputs.erase(outputs.begin() + 1); 180 outputs.erase(outputs.begin() + 1);
186 observer_->OnDisplayModeChanged(outputs); 181 observer_->OnDisplayModeChanged(outputs);
187 182
188 EXPECT_EQ(2, fake_power_client_->num_set_is_projecting_calls()); 183 EXPECT_EQ(2, fake_power_client_->num_set_is_projecting_calls());
189 EXPECT_FALSE(fake_power_client_->is_projecting()); 184 EXPECT_FALSE(fake_power_client_->is_projecting());
190 } 185 }
191 186
192 } // namespace ash 187 } // namespace ash
OLDNEW
« no previous file with comments | « no previous file | ash/system/chromeos/network/network_state_notifier_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698