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

Side by Side Diff: chrome/browser/chromeos/media/media_player_browsertest.cc

Issue 7067020: Moving mediaplayer to the chrome filebrowser. Observable behaviour should not change. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Resolved conflicts. Created 9 years, 7 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
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/command_line.h" 5 #include "base/command_line.h"
6 #include "base/memory/ref_counted.h" 6 #include "base/memory/ref_counted.h"
7 #include "base/utf_string_conversions.h" 7 #include "base/utf_string_conversions.h"
8 #include "chrome/browser/chromeos/media/media_player.h"
8 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
9 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_list.h"
10 #include "chrome/browser/ui/webui/mediaplayer_ui.h"
11 #include "chrome/common/chrome_switches.h" 11 #include "chrome/common/chrome_switches.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "chrome/test/automation/dom_element_proxy.h" 13 #include "chrome/test/automation/dom_element_proxy.h"
14 #include "chrome/test/in_process_browser_test.h" 14 #include "chrome/test/in_process_browser_test.h"
15 #include "chrome/test/ui_test_utils.h" 15 #include "chrome/test/ui_test_utils.h"
16 #include "content/browser/tab_contents/tab_contents.h" 16 #include "content/browser/tab_contents/tab_contents.h"
17 17
18 namespace {
19
20 class MediaPlayerBrowserTest : public InProcessBrowserTest { 18 class MediaPlayerBrowserTest : public InProcessBrowserTest {
21 public: 19 public:
22 MediaPlayerBrowserTest() {} 20 MediaPlayerBrowserTest() {}
23 21
24 GURL GetMusicTestURL() { 22 GURL GetMusicTestURL() {
25 return GURL("http://localhost:1337/files/plugin/sample_mp3.mp3"); 23 return GURL("http://localhost:1337/files/plugin/sample_mp3.mp3");
26 } 24 }
27 25
28 bool IsPlayerVisible() { 26 bool IsBrowserVisible(Browser* browser) {
27 if (browser == NULL)
28 return false;
29 for (BrowserList::const_iterator it = BrowserList::begin(); 29 for (BrowserList::const_iterator it = BrowserList::begin();
30 it != BrowserList::end(); ++it) { 30 it != BrowserList::end(); ++it) {
31 if ((*it)->is_type_panel() && (*it)->is_app()) { 31 if ((*it)->is_type_panel() && (*it)->is_app() && (*it) == browser)
32 const GURL& url = 32 return true;
33 (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
34
35 if (url.SchemeIs(chrome::kChromeUIScheme) &&
36 url.host() == chrome::kChromeUIMediaplayerHost) {
37 return true;
38 }
39 }
40 } 33 }
41 return false; 34 return false;
42 } 35 }
43 36
37 bool IsPlayerVisible() {
38 return IsBrowserVisible(MediaPlayer::GetInstance()->mediaplayer_browser_);
39 }
40
44 bool IsPlaylistVisible() { 41 bool IsPlaylistVisible() {
45 for (BrowserList::const_iterator it = BrowserList::begin(); 42 return IsBrowserVisible(MediaPlayer::GetInstance()->playlist_browser_);
46 it != BrowserList::end(); ++it) {
47 if ((*it)->is_type_panel() && (*it)->is_app()) {
48 const GURL& url =
49 (*it)->GetTabContentsAt((*it)->active_index())->GetURL();
50
51 if (url.SchemeIs(chrome::kChromeUIScheme) &&
52 url.host() == chrome::kChromeUIMediaplayerHost &&
53 url.ref() == "playlist") {
54 return true;
55 }
56 }
57 }
58 return false;
59 } 43 }
60 }; 44 };
61 45
62 IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) { 46 IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) {
63 ASSERT_TRUE(test_server()->Start()); 47 ASSERT_TRUE(test_server()->Start());
64 // Doing this so we have a valid profile. 48 // Doing this so we have a valid profile.
65 ui_test_utils::NavigateToURL(browser(), 49 ui_test_utils::NavigateToURL(browser(),
66 GURL("chrome://downloads")); 50 GURL("chrome://downloads"));
67 51
68 MediaPlayer* player = MediaPlayer::GetInstance(); 52 MediaPlayer* player = MediaPlayer::GetInstance();
(...skipping 16 matching lines...) Expand all
85 69
86 player->EnqueueMediaFileUrl(GetMusicTestURL(), NULL); 70 player->EnqueueMediaFileUrl(GetMusicTestURL(), NULL);
87 71
88 EXPECT_FALSE(IsPlaylistVisible()); 72 EXPECT_FALSE(IsPlaylistVisible());
89 73
90 player->TogglePlaylistWindowVisible(); 74 player->TogglePlaylistWindowVisible();
91 75
92 EXPECT_TRUE(IsPlaylistVisible()); 76 EXPECT_TRUE(IsPlaylistVisible());
93 } 77 }
94 78
95 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/media/media_player.cc ('k') | chrome/browser/extensions/extension_file_browser_private_api.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698