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

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

Issue 12213075: Swap deprecated BrowserList:: iterators for BrowserIterator in non-Windows code. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: merge up to r181832 Created 7 years, 10 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) 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/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/chromeos/media/media_player.h"
9 #include "chrome/browser/ui/browser.h" 9 #include "chrome/browser/ui/browser.h"
10 #include "chrome/browser/ui/browser_list.h" 10 #include "chrome/browser/ui/browser_iterator.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/base/in_process_browser_test.h" 13 #include "chrome/test/base/in_process_browser_test.h"
14 #include "chrome/test/base/ui_test_utils.h" 14 #include "chrome/test/base/ui_test_utils.h"
15 15
16 class MediaPlayerBrowserTest : public InProcessBrowserTest { 16 class MediaPlayerBrowserTest : public InProcessBrowserTest {
17 public: 17 public:
18 MediaPlayerBrowserTest() {} 18 MediaPlayerBrowserTest() {}
19 19
20 GURL GetMusicTestURL() { 20 GURL GetMusicTestURL() {
21 return GURL("http://localhost:1337/files/plugin/sample_mp3.mp3"); 21 return GURL("http://localhost:1337/files/plugin/sample_mp3.mp3");
22 } 22 }
23 23
24 bool IsBrowserVisible(Browser* browser) { 24 bool IsBrowserVisible(Browser* browser) {
25 if (browser == NULL) 25 if (browser == NULL)
26 return false; 26 return false;
27 for (BrowserList::const_iterator it = BrowserList::begin(); 27 for (chrome::BrowserIterator it; !it.done(); it.Next()) {
28 it != BrowserList::end(); ++it) { 28 if (it->is_type_popup() && it->is_app() && (*it) == browser)
29 if ((*it)->is_type_popup() && (*it)->is_app() && (*it) == browser)
30 return true; 29 return true;
31 } 30 }
32 return false; 31 return false;
33 } 32 }
34 33
35 bool IsPlayerVisible() { 34 bool IsPlayerVisible() {
36 return IsBrowserVisible(MediaPlayer::GetInstance()->GetBrowser()); 35 return IsBrowserVisible(MediaPlayer::GetInstance()->GetBrowser());
37 } 36 }
38 }; 37 };
39 38
40 IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) { 39 IN_PROC_BROWSER_TEST_F(MediaPlayerBrowserTest, Popup) {
41 ASSERT_TRUE(test_server()->Start()); 40 ASSERT_TRUE(test_server()->Start());
42 // Doing this so we have a valid profile. 41 // Doing this so we have a valid profile.
43 ui_test_utils::NavigateToURL(browser(), 42 ui_test_utils::NavigateToURL(browser(),
44 GURL("chrome://downloads")); 43 GURL("chrome://downloads"));
45 44
46 MediaPlayer* player = MediaPlayer::GetInstance(); 45 MediaPlayer* player = MediaPlayer::GetInstance();
47 // Check that its not currently visible 46 // Check that its not currently visible
48 ASSERT_FALSE(IsPlayerVisible()); 47 ASSERT_FALSE(IsPlayerVisible());
49 48
50 player->PopupMediaPlayer(); 49 player->PopupMediaPlayer();
51 player->ForcePlayMediaURL(GetMusicTestURL()); 50 player->ForcePlayMediaURL(GetMusicTestURL());
52 51
53 ASSERT_TRUE(IsPlayerVisible()); 52 ASSERT_TRUE(IsPlayerVisible());
54 } 53 }
OLDNEW
« no previous file with comments | « chrome/browser/chromeos/media/media_player.cc ('k') | chrome/browser/chromeos/memory/oom_priority_manager.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698