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

Unified Diff: chrome/browser/chromeos/cros/mock_mount_library.h

Issue 1238006: Adding new test for mount observer. Also changing the usb mounter to only rel... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 10 years, 9 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/mock_mount_library.cc » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/cros/mock_mount_library.h
===================================================================
--- chrome/browser/chromeos/cros/mock_mount_library.h (revision 42629)
+++ chrome/browser/chromeos/cros/mock_mount_library.h (working copy)
@@ -1,4 +1,4 @@
-// Copyright (c) 2010 The Chromium Authors. All rights reserved.
+// Copyright (c) 2009 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
@@ -6,19 +6,47 @@
#define CHROME_BROWSER_CHROMEOS_CROS_MOCK_MOUNT_LIBRARY_H_
#include <string>
+#include <vector>
+#include "base/observer_list.h"
+#include "base/time.h"
+#include "third_party/cros/chromeos_mount.h"
#include "chrome/browser/chromeos/cros/mount_library.h"
+#include "testing/gtest/include/gtest/gtest.h"
#include "testing/gmock/include/gmock/gmock.h"
namespace chromeos {
+// This class handles the interaction with the ChromeOS mount library APIs.
+// Classes can add themselves as observers. Users can get an instance of this
+// library class like this: MountLibrary::Get().
class MockMountLibrary : public MountLibrary {
public:
- MockMountLibrary() {}
- virtual ~MockMountLibrary() {}
- MOCK_METHOD1(AddObserver, void(Observer*));
- MOCK_METHOD1(RemoveObserver, void(Observer*));
- MOCK_CONST_METHOD0(disks, const DiskVector&(void));
+ MockMountLibrary();
+ virtual ~MockMountLibrary();
+
+ MOCK_METHOD1(AddObserver, void(MountLibrary::Observer*));
+ MOCK_METHOD1(RemoveObserver, void(MountLibrary::Observer*));
+ MOCK_CONST_METHOD0(disks, const MountLibrary::DiskVector&(void));
+
+ void FireDeviceInsertEvents();
+ void FireDeviceRemoveEvents();
+
+ private:
+ void AddObserverInternal(MountLibrary::Observer* observer);
+ void RemoveObserverInternal(MountLibrary::Observer* observer);
+ const MountLibrary::DiskVector& disksInternal() const { return disks_; }
+
+
+ void UpdateMountStatus(MountEventType evt,
+ const std::string& path);
+
+ ObserverList<MountLibrary::Observer> observers_;
+
+ // The list of disks found.
+ MountLibrary::DiskVector disks_;
+
+ DISALLOW_COPY_AND_ASSIGN(MockMountLibrary);
};
} // namespace chromeos
« no previous file with comments | « no previous file | chrome/browser/chromeos/cros/mock_mount_library.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698