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

Side by Side Diff: chrome/browser/storage_monitor/image_capture_device_manager_unittest.mm

Issue 15988011: Refine StorageMonitor storage device getter (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix SystemInfoStorageApiTest failures in browser_tests Created 7 years, 6 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 (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 5
6 #import <Foundation/Foundation.h> 6 #import <Foundation/Foundation.h>
7 #import <ImageCaptureCore/ImageCaptureCore.h> 7 #import <ImageCaptureCore/ImageCaptureCore.h>
8 8
9 #include "base/file_util.h" 9 #include "base/file_util.h"
10 #include "base/files/file_path.h" 10 #include "base/files/file_path.h"
(...skipping 268 matching lines...) Expand 10 before | Expand all | Expand 10 after
279 base::MessageLoopForUI message_loop_; 279 base::MessageLoopForUI message_loop_;
280 scoped_ptr<content::TestBrowserThread> ui_thread_; 280 scoped_ptr<content::TestBrowserThread> ui_thread_;
281 chrome::test::TestStorageMonitor monitor_; 281 chrome::test::TestStorageMonitor monitor_;
282 TestCameraListener listener_; 282 TestCameraListener listener_;
283 }; 283 };
284 284
285 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) { 285 TEST_F(ImageCaptureDeviceManagerTest, TestAttachDetach) {
286 chrome::ImageCaptureDeviceManager manager; 286 chrome::ImageCaptureDeviceManager manager;
287 manager.SetNotifications(monitor_.receiver()); 287 manager.SetNotifications(monitor_.receiver());
288 ICCameraDevice* device = AttachDevice(&manager); 288 ICCameraDevice* device = AttachDevice(&manager);
289 std::vector<chrome::StorageInfo> devices = monitor_.GetAttachedStorage(); 289 std::vector<chrome::StorageInfo> devices =
290 monitor_.GetAllAvailableStorages();
290 291
291 ASSERT_EQ(1U, devices.size()); 292 ASSERT_EQ(1U, devices.size());
292 EXPECT_EQ(std::string("ic:") + kDeviceId, devices[0].device_id()); 293 EXPECT_EQ(std::string("ic:") + kDeviceId, devices[0].device_id());
293 294
294 DetachDevice(&manager, device); 295 DetachDevice(&manager, device);
295 devices = monitor_.GetAttachedStorage(); 296 devices = monitor_.GetAllAvailableStorages();
296 ASSERT_EQ(0U, devices.size()); 297 ASSERT_EQ(0U, devices.size());
297 }; 298 };
298 299
299 TEST_F(ImageCaptureDeviceManagerTest, OpenCamera) { 300 TEST_F(ImageCaptureDeviceManagerTest, OpenCamera) {
300 chrome::ImageCaptureDeviceManager manager; 301 chrome::ImageCaptureDeviceManager manager;
301 manager.SetNotifications(monitor_.receiver()); 302 manager.SetNotifications(monitor_.receiver());
302 ICCameraDevice* device = AttachDevice(&manager); 303 ICCameraDevice* device = AttachDevice(&manager);
303 304
304 EXPECT_FALSE(chrome::ImageCaptureDeviceManager::deviceForUUID( 305 EXPECT_FALSE(chrome::ImageCaptureDeviceManager::deviceForUUID(
305 "nonexistent")); 306 "nonexistent"));
(...skipping 133 matching lines...) Expand 10 before | Expand all | Expand 10 after
439 message_loop_.RunUntilIdle(); 440 message_loop_.RunUntilIdle();
440 441
441 char file_contents[5]; 442 char file_contents[5];
442 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents, 443 ASSERT_EQ(4, file_util::ReadFile(temp_file, file_contents,
443 strlen(kTestFileContents))); 444 strlen(kTestFileContents)));
444 EXPECT_EQ(kTestFileContents, 445 EXPECT_EQ(kTestFileContents,
445 std::string(file_contents, strlen(kTestFileContents))); 446 std::string(file_contents, strlen(kTestFileContents)));
446 447
447 [camera didRemoveDevice:device]; 448 [camera didRemoveDevice:device];
448 } 449 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698