Commit 07b14715 authored by gab@chromium.org's avatar gab@chromium.org

Explicitly hardcode tab_drag_controller_interactive_uitest.cc to use the native desktop list.

Getting rid of some of the last BrowserList:: iterator methods :)!

Also making BrowserListImpl const-safe (otherwise GetLastActive(), required in this CL, couldn't be used on a const BrowserListImpl*).

BUG=129187

Review URL: https://codereview.chromium.org/12213091

git-svn-id: svn://svn.chromium.org/chrome/trunk/src@181984 0039d316-1c4b-4281-b951-d872f2087c98
parent 93df0a1f
......@@ -111,13 +111,13 @@ void BrowserListImpl::SetLastActive(Browser* browser) {
OnBrowserSetLastActive(browser));
}
Browser* BrowserListImpl::GetLastActive() {
Browser* BrowserListImpl::GetLastActive() const {
if (!last_active_browsers_.empty())
return *(last_active_browsers_.rbegin());
return NULL;
}
bool BrowserListImpl::IsIncognitoWindowOpen() {
bool BrowserListImpl::IsIncognitoWindowOpen() const {
for (BrowserListImpl::const_iterator i = BrowserListImpl::begin();
i != BrowserListImpl::end(); ++i) {
if ((*i)->profile()->IsOffTheRecord())
......@@ -126,7 +126,7 @@ bool BrowserListImpl::IsIncognitoWindowOpen() {
return false;
}
bool BrowserListImpl::IsIncognitoWindowOpenForProfile(Profile* profile) {
bool BrowserListImpl::IsIncognitoWindowOpenForProfile(Profile* profile) const {
#if defined(OS_CHROMEOS)
// In ChromeOS, we assume that the default profile is always valid, so if
// we are in guest mode, keep the OTR profile active so it won't be deleted.
......
......@@ -40,7 +40,7 @@ class BrowserListImpl {
// allows us to determine what the last active Browser was.
void SetLastActive(Browser* browser);
Browser* GetLastActive();
Browser* GetLastActive() const;
// Browsers are added to the list before they have constructed windows,
// so the |window()| member function may return NULL.
......@@ -56,18 +56,18 @@ class BrowserListImpl {
// they were last active. The underlying data structure is a vector
// and we push_back on recent access so a reverse iterator gives the
// latest accessed browser first.
const_reverse_iterator begin_last_active() {
const_reverse_iterator begin_last_active() const {
return last_active_browsers_.rbegin();
}
const_reverse_iterator end_last_active() {
const_reverse_iterator end_last_active() const {
return last_active_browsers_.rend();
}
// Returns true if at least one incognito window is open.
bool IsIncognitoWindowOpen();
bool IsIncognitoWindowOpen() const;
// Returns true if at least one incognito window is open for |profile|.
bool IsIncognitoWindowOpenForProfile(Profile* profile);
bool IsIncognitoWindowOpenForProfile(Profile* profile) const;
private:
BrowserListImpl();
......
......@@ -13,6 +13,10 @@ class Browser;
class TabStrip;
class TabStripModel;
namespace chrome {
class BrowserListImpl;
}
namespace content {
class WebContents;
}
......@@ -43,6 +47,10 @@ class TabDragControllerTest : public InProcessBrowserTest {
// side by side.
Browser* CreateAnotherWindowBrowserAndRelayout();
// The tab drag controller interactive ui tests only use the native desktop
// for now.
const chrome::BrowserListImpl* native_browser_list;
private:
DISALLOW_COPY_AND_ASSIGN(TabDragControllerTest);
};
......
......@@ -9,7 +9,7 @@
#include "base/command_line.h"
#include "base/strings/string_number_conversions.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_window.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/views/frame/browser_view.h"
......@@ -129,8 +129,8 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DetachToOwnWindow) {
ASSERT_FALSE(TabDragController::IsActive());
// There should now be another browser.
ASSERT_EQ(2u, BrowserList::size());
Browser* new_browser = *(++BrowserList::begin());
ASSERT_EQ(2u, native_browser_list->size());
Browser* new_browser = native_browser_list->get(1);
ASSERT_TRUE(new_browser->window()->IsActive());
TabStrip* tab_strip2 = GetTabStripForBrowser(new_browser);
ASSERT_FALSE(tab_strip2->IsDragSessionActive());
......@@ -247,8 +247,8 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DeleteSourceDetached) {
// Releasing the mouse should destroy the existing browser and create a new
// one.
ASSERT_EQ(1u, BrowserList::size());
Browser* new_browser = *BrowserList::begin();
ASSERT_EQ(1u, native_browser_list->size());
Browser* new_browser = native_browser_list->get(0);
EXPECT_NE(new_browser, browser());
ASSERT_FALSE(GetTabStripForBrowser(new_browser)->IsDragSessionActive());
......@@ -285,7 +285,7 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest, DragAllToSeparateWindow) {
ASSERT_TRUE(tab_strip->IsDragSessionActive());
ASSERT_FALSE(tab_strip2->IsDragSessionActive());
ASSERT_TRUE(TabDragController::IsActive());
ASSERT_EQ(2u, BrowserList::size());
ASSERT_EQ(2u, native_browser_list->size());
// Drag to tab_strip2.
gfx::Point target_point(tab_strip2->width() - 1,
......@@ -333,7 +333,7 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest,
ASSERT_TRUE(tab_strip->IsDragSessionActive());
ASSERT_FALSE(tab_strip2->IsDragSessionActive());
ASSERT_TRUE(TabDragController::IsActive());
ASSERT_EQ(2u, BrowserList::size());
ASSERT_EQ(2u, native_browser_list->size());
// Drag to tab_strip2.
gfx::Point target_point(tab_strip2->width() - 1,
......@@ -343,7 +343,7 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest,
ASSERT_TRUE(tab_strip->IsDragSessionActive());
ASSERT_TRUE(TabDragController::IsActive());
ASSERT_EQ(2u, BrowserList::size());
ASSERT_EQ(2u, native_browser_list->size());
// Cancel the drag.
ASSERT_TRUE(ui_test_utils::SendKeyPressSync(
......@@ -352,7 +352,7 @@ IN_PROC_BROWSER_TEST_F(TabDragControllerTest,
ASSERT_FALSE(tab_strip->IsDragSessionActive());
ASSERT_FALSE(tab_strip2->IsDragSessionActive());
ASSERT_FALSE(TabDragController::IsActive());
ASSERT_EQ(2u, BrowserList::size());
ASSERT_EQ(2u, native_browser_list->size());
EXPECT_EQ("0 1", IDString(browser()->tab_strip_model()));
EXPECT_EQ("100", IDString(browser2->tab_strip_model()));
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment