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

Unified Diff: chrome/browser/ui/browser_command_controller_unittest.cc

Issue 877413004: Refactor away the Browser* dependency in exclusive_access (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Fix broken mac change Created 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/ui/browser_command_controller_unittest.cc
diff --git a/chrome/browser/ui/browser_command_controller_unittest.cc b/chrome/browser/ui/browser_command_controller_unittest.cc
index 0242a0a75cd86c45232d3ed40bd0b019345b0b5e..a80c7580269c2bda4d415bcf53fdbd1e101d70e7 100644
--- a/chrome/browser/ui/browser_command_controller_unittest.cc
+++ b/chrome/browser/ui/browser_command_controller_unittest.cc
@@ -14,6 +14,8 @@
#include "chrome/browser/ui/browser.h"
#include "chrome/browser/ui/browser_commands.h"
#include "chrome/browser/ui/browser_window_state.h"
+#include "chrome/browser/ui/exclusive_access/exclusive_access_context.h"
+#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/common/chrome_switches.h"
#include "chrome/common/pref_names.h"
#include "chrome/test/base/browser_with_test_window_test.h"
@@ -267,11 +269,16 @@ TEST_F(BrowserCommandControllerTest, AvatarMenuAlwaysDisabledInIncognitoMode) {
}
//////////////////////////////////////////////////////////////////////////////
+class BrowserCommandControllerFullscreenTest;
// A test browser window that can toggle fullscreen state.
-class FullscreenTestBrowserWindow : public TestBrowserWindow {
+class FullscreenTestBrowserWindow : public TestBrowserWindow,
+ ExclusiveAccessContext {
public:
- FullscreenTestBrowserWindow() : fullscreen_(false) {}
+ FullscreenTestBrowserWindow(
+ BrowserCommandControllerFullscreenTest* test_browser)
+ : fullscreen_(false), test_browser_(test_browser) {}
+
~FullscreenTestBrowserWindow() override {}
// TestBrowserWindow overrides:
@@ -284,8 +291,21 @@ class FullscreenTestBrowserWindow : public TestBrowserWindow {
}
void ExitFullscreen() override { fullscreen_ = false; }
+ ExclusiveAccessContext* GetExclusiveAccessContext() override { return this; }
+
+ // Exclusive access interface:
+ Profile* GetProfile() override;
+ content::WebContents* GetActiveWebContents() override;
+ void HideDownloadShelf() override {}
+ void UnhideDownloadShelf() override {}
+ void UpdateExclusiveAccessExitBubbleContent(
+ const GURL& url,
+ ExclusiveAccessBubbleType bubble_type) override {}
+ bool IsFullscreenWithToolbar() const override { return IsFullscreen(); }
+
private:
bool fullscreen_;
+ BrowserCommandControllerFullscreenTest* test_browser_;
DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow);
};
@@ -297,15 +317,25 @@ class BrowserCommandControllerFullscreenTest
BrowserCommandControllerFullscreenTest() {}
~BrowserCommandControllerFullscreenTest() override {}
+ Browser* GetBrowser() { return BrowserWithTestWindowTest::browser(); }
+
// BrowserWithTestWindowTest overrides:
BrowserWindow* CreateBrowserWindow() override {
- return new FullscreenTestBrowserWindow;
+ return new FullscreenTestBrowserWindow(this);
}
private:
DISALLOW_COPY_AND_ASSIGN(BrowserCommandControllerFullscreenTest);
};
+Profile* FullscreenTestBrowserWindow::GetProfile() {
+ return test_browser_->GetBrowser()->profile();
+}
+
+content::WebContents* FullscreenTestBrowserWindow::GetActiveWebContents() {
+ return test_browser_->GetBrowser()->tab_strip_model()->GetActiveWebContents();
+}
+
TEST_F(BrowserCommandControllerFullscreenTest,
UpdateCommandsForFullscreenMode) {
// Defaults for a tabbed browser.
« no previous file with comments | « chrome/browser/ui/browser.cc ('k') | chrome/browser/ui/browser_window.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698