summaryrefslogtreecommitdiffstats
path: root/chrome/test/base
diff options
context:
space:
mode:
authorgab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 06:15:56 +0000
committergab@chromium.org <gab@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2013-02-12 06:15:56 +0000
commitbc44f414c8f8d382bf860edbf05439d3678a12f6 (patch)
treeff12c42594f6edba018749c5bcd30532552b4c8a /chrome/test/base
parent311078b633a051ea0beae74cdaac77ff5addbe20 (diff)
downloadchromium_src-bc44f414c8f8d382bf860edbf05439d3678a12f6.zip
chromium_src-bc44f414c8f8d382bf860edbf05439d3678a12f6.tar.gz
chromium_src-bc44f414c8f8d382bf860edbf05439d3678a12f6.tar.bz2
Get rid of native-desktop-only BrowserList:: iterator methods in tests.
This is the last CL to get rid of BrowserList::const_iterator, BrowserList::begin(), and BrowserList::end() entirely (hopefully -- i.e., I can now build chrome, browser_tests, and unit_tests without these 3 methods -- there are 3 other CLs in the pipeline in parallel, I will land a CL to remove those methods for good once ToT no longer requires them)! Various browser tests were already making explicit assumptions about native-desktop, hardcoding that some more in some places. Otherwise just replacing all the iterators by BrowserIterator (which in theory is multi-desktop, but in browser tests only the native desktop's list will have browsers for now). Further changes can be made independently later if multi-desktop browser tests are desired. BUG=129187 Review URL: https://chromiumcodereview.appspot.com/12210067 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181878 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/test/base')
-rw-r--r--chrome/test/base/in_process_browser_test.cc9
-rw-r--r--chrome/test/base/ui_test_utils.cc20
2 files changed, 15 insertions, 14 deletions
diff --git a/chrome/test/base/in_process_browser_test.cc b/chrome/test/base/in_process_browser_test.cc
index ca7d989..239a083 100644
--- a/chrome/test/base/in_process_browser_test.cc
+++ b/chrome/test/base/in_process_browser_test.cc
@@ -22,9 +22,11 @@
#include "chrome/browser/profiles/profile_manager.h"
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_list.h"
+#include "chrome/browser/ui/browser_list_impl.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_tabstrip.h"
#include "chrome/browser/ui/browser_window.h"
+#include "chrome/browser/ui/host_desktop.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_constants.h"
#include "chrome/common/chrome_paths.h"
@@ -326,8 +328,11 @@ void InProcessBrowserTest::RunTestOnMainThreadLoop() {
autorelease_pool_->Recycle();
#endif
- if (!BrowserList::empty()) {
- browser_ = *BrowserList::begin();
+ // Browser tests do not support multi-desktop for now.
+ const chrome::BrowserListImpl* native_browser_list =
+ chrome::BrowserListImpl::GetInstance(chrome::HOST_DESKTOP_TYPE_NATIVE);
+ if (!native_browser_list->empty()) {
+ browser_ = native_browser_list->get(0);
#if defined(USE_ASH)
// There are cases where windows get created maximized by default.
if (browser_->window()->IsMaximized())
diff --git a/chrome/test/base/ui_test_utils.cc b/chrome/test/base/ui_test_utils.cc
index d8245f1..29b5236 100644
--- a/chrome/test/base/ui_test_utils.cc
+++ b/chrome/test/base/ui_test_utils.cc
@@ -36,6 +36,7 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_finder.h"
+#include "chrome/browser/ui/browser_iterator.h"
#include "chrome/browser/ui/browser_list.h"
#include "chrome/browser/ui/browser_navigator.h"
#include "chrome/browser/ui/browser_window.h"
@@ -260,11 +261,8 @@ static void NavigateToURLWithDispositionBlockUntilNavigationsComplete(
number_of_navigations);
std::set<Browser*> initial_browsers;
- for (std::vector<Browser*>::const_iterator iter = BrowserList::begin();
- iter != BrowserList::end();
- ++iter) {
- initial_browsers.insert(*iter);
- }
+ for (chrome::BrowserIterator it; !it.done(); it.Next())
+ initial_browsers.insert(*it);
content::WindowedNotificationObserver tab_added_observer(
chrome::NOTIFICATION_TAB_ADDED,
@@ -477,13 +475,10 @@ void SendToOmniboxAndSubmit(LocationBar* location_bar,
}
Browser* GetBrowserNotInSet(std::set<Browser*> excluded_browsers) {
- for (BrowserList::const_iterator iter = BrowserList::begin();
- iter != BrowserList::end();
- ++iter) {
- if (excluded_browsers.find(*iter) == excluded_browsers.end())
- return *iter;
+ for (chrome::BrowserIterator it; !it.done(); it.Next()) {
+ if (excluded_browsers.find(*it) == excluded_browsers.end())
+ return *it;
}
-
return NULL;
}
@@ -525,7 +520,8 @@ BrowserAddedObserver::BrowserAddedObserver()
: notification_observer_(
chrome::NOTIFICATION_BROWSER_OPENED,
content::NotificationService::AllSources()) {
- original_browsers_.insert(BrowserList::begin(), BrowserList::end());
+ for (chrome::BrowserIterator it; !it.done(); it.Next())
+ original_browsers_.insert(*it);
}
BrowserAddedObserver::~BrowserAddedObserver() {