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

Side by Side Diff: chromeos/disks/disk_mount_manager_unittest.cc

Issue 49773003: ChromeOS: Remove MockDBusThreadManager. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fixed tests. Created 7 years, 1 month 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
OLDNEW
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 "base/bind.h" 5 #include "base/bind.h"
6 #include "base/message_loop/message_loop.h" 6 #include "base/message_loop/message_loop.h"
7 #include "chromeos/dbus/fake_cros_disks_client.h" 7 #include "chromeos/dbus/fake_cros_disks_client.h"
8 #include "chromeos/dbus/fake_dbus_thread_manager.h" 8 #include "chromeos/dbus/fake_dbus_thread_manager.h"
9 #include "chromeos/disks/disk_mount_manager.h" 9 #include "chromeos/disks/disk_mount_manager.h"
10 #include "testing/gmock/include/gmock/gmock.h" 10 #include "testing/gmock/include/gmock/gmock.h"
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after
115 class DiskMountManagerTest : public testing::Test { 115 class DiskMountManagerTest : public testing::Test {
116 public: 116 public:
117 DiskMountManagerTest() {} 117 DiskMountManagerTest() {}
118 virtual ~DiskMountManagerTest() {} 118 virtual ~DiskMountManagerTest() {}
119 119
120 // Sets up test dbus tread manager and disks mount manager. 120 // Sets up test dbus tread manager and disks mount manager.
121 // Initializes disk mount manager disks and mount points. 121 // Initializes disk mount manager disks and mount points.
122 // Adds a test observer to the disk mount manager. 122 // Adds a test observer to the disk mount manager.
123 virtual void SetUp() { 123 virtual void SetUp() {
124 FakeDBusThreadManager* fake_thread_manager = new FakeDBusThreadManager(); 124 FakeDBusThreadManager* fake_thread_manager = new FakeDBusThreadManager();
125 fake_cros_disks_client_ = new FakeCrosDisksClient;
126 fake_thread_manager->SetCrosDisksClient(
127 scoped_ptr<CrosDisksClient>(fake_cros_disks_client_));
128
125 DBusThreadManager::InitializeForTesting(fake_thread_manager); 129 DBusThreadManager::InitializeForTesting(fake_thread_manager);
126 130
127 fake_cros_disks_client_ = fake_thread_manager->fake_cros_disks_client();
128
129 DiskMountManager::Initialize(); 131 DiskMountManager::Initialize();
130 132
131 InitDisksAndMountPoints(); 133 InitDisksAndMountPoints();
132 134
133 DiskMountManager::GetInstance()->AddObserver(&observer_); 135 DiskMountManager::GetInstance()->AddObserver(&observer_);
134 } 136 }
135 137
136 // Shuts down dbus thread manager and disk moutn manager used in the test. 138 // Shuts down dbus thread manager and disk moutn manager used in the test.
137 virtual void TearDown() { 139 virtual void TearDown() {
138 DiskMountManager::GetInstance()->RemoveObserver(&observer_); 140 DiskMountManager::GetInstance()->RemoveObserver(&observer_);
(...skipping 484 matching lines...) Expand 10 before | Expand all | Expand 10 after
623 fake_cros_disks_client_->last_format_device_device_path()); 625 fake_cros_disks_client_->last_format_device_device_path());
624 EXPECT_EQ("vfat", 626 EXPECT_EQ("vfat",
625 fake_cros_disks_client_->last_format_device_filesystem()); 627 fake_cros_disks_client_->last_format_device_filesystem());
626 628
627 // Simulate cros_disks reporting success. 629 // Simulate cros_disks reporting success.
628 fake_cros_disks_client_->SendMountEvent( 630 fake_cros_disks_client_->SendMountEvent(
629 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path"); 631 chromeos::CROS_DISKS_FORMATTING_FINISHED, "/device/source_path");
630 } 632 }
631 633
632 } // namespace 634 } // namespace
OLDNEW
« no previous file with comments | « chromeos/dbus/power_policy_controller_unittest.cc ('k') | chromeos/network/managed_network_configuration_handler_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698