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

Unified Diff: chrome/browser/chromeos/usb_mount_observer_browsertest.cc

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 | « chrome/browser/chromeos/usb_mount_observer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/chromeos/usb_mount_observer_browsertest.cc
===================================================================
--- chrome/browser/chromeos/usb_mount_observer_browsertest.cc (revision 0)
+++ chrome/browser/chromeos/usb_mount_observer_browsertest.cc (revision 0)
@@ -0,0 +1,57 @@
+// Copyright (c) 2010 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.
+
+#include "base/ref_counted.h"
+#include "base/utf_string_conversions.h"
+#include "chrome/test/automation/dom_element_proxy.h"
+#include "chrome/browser/browser.h"
+#include "chrome/browser/browser_list.h"
+#include "chrome/browser/chromeos/cros/mock_mount_library.h"
+#include "chrome/browser/chromeos/usb_mount_observer.h"
+#include "chrome/browser/dom_ui/mediaplayer_ui.h"
+#include "chrome/browser/tab_contents/tab_contents.h"
+#include "chrome/common/url_constants.h"
+#include "chrome/test/in_process_browser_test.h"
+#include "chrome/test/ui_test_utils.h"
+
+namespace {
+
+class USBMountObserverBrowserTest : public InProcessBrowserTest {
+ public:
+ USBMountObserverBrowserTest() {}
+
+ bool IsFilebrowserVisible() {
+ for (BrowserList::const_iterator it = BrowserList::begin();
+ it != BrowserList::end(); ++it) {
+ if ((*it)->type() == Browser::TYPE_POPUP) {
+ const GURL& url =
+ (*it)->GetTabContentsAt((*it)->selected_index())->GetURL();
+ if (url.SchemeIs(chrome::kChromeUIScheme) &&
+ url.host() == chrome::kChromeUIFileBrowseHost) {
+ return true;
+ }
+ }
+ }
+ return false;
+ }
+};
+
+IN_PROC_BROWSER_TEST_F(USBMountObserverBrowserTest, PopupOnEvent) {
+ StartHTTPServer();
+ // Doing this so we have a valid profile
+ ui_test_utils::NavigateToURL(browser(),
+ GURL(chrome::kChromeUIDownloadsURL));
+ chromeos::USBMountObserver* observe = chromeos::USBMountObserver::Get();
+ observe->set_profile(browser()->profile());
+ scoped_ptr<chromeos::MockMountLibrary> lib(new chromeos::MockMountLibrary());
+ lib->AddObserver(observe);
+ // Check that its not currently visible
+ EXPECT_FALSE(IsFilebrowserVisible());
+
+ lib->FireDeviceInsertEvents();
+
+ EXPECT_TRUE(IsFilebrowserVisible());
+}
+
+}
« no previous file with comments | « chrome/browser/chromeos/usb_mount_observer.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698