OLD | NEW |
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 "chrome/browser/ui/browser_command_controller.h" | 5 #include "chrome/browser/ui/browser_command_controller.h" |
6 | 6 |
7 #include "base/command_line.h" | 7 #include "base/command_line.h" |
8 #include "chrome/app/chrome_command_ids.h" | 8 #include "chrome/app/chrome_command_ids.h" |
9 #include "chrome/browser/browser_process.h" | 9 #include "chrome/browser/browser_process.h" |
10 #include "chrome/browser/command_updater.h" | 10 #include "chrome/browser/command_updater.h" |
(...skipping 291 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
302 | 302 |
303 ////////////////////////////////////////////////////////////////////////////// | 303 ////////////////////////////////////////////////////////////////////////////// |
304 | 304 |
305 // A test browser window that can toggle fullscreen state. | 305 // A test browser window that can toggle fullscreen state. |
306 class FullscreenTestBrowserWindow : public TestBrowserWindow { | 306 class FullscreenTestBrowserWindow : public TestBrowserWindow { |
307 public: | 307 public: |
308 FullscreenTestBrowserWindow() : fullscreen_(false) {} | 308 FullscreenTestBrowserWindow() : fullscreen_(false) {} |
309 virtual ~FullscreenTestBrowserWindow() {} | 309 virtual ~FullscreenTestBrowserWindow() {} |
310 | 310 |
311 // TestBrowserWindow overrides: | 311 // TestBrowserWindow overrides: |
312 virtual bool ShouldHideUIForFullscreen() const OVERRIDE { | 312 virtual bool ShouldHideUIForFullscreen() const override { |
313 return fullscreen_; | 313 return fullscreen_; |
314 } | 314 } |
315 virtual bool IsFullscreen() const OVERRIDE { | 315 virtual bool IsFullscreen() const override { |
316 return fullscreen_; | 316 return fullscreen_; |
317 } | 317 } |
318 virtual void EnterFullscreen( | 318 virtual void EnterFullscreen( |
319 const GURL& url, FullscreenExitBubbleType type) OVERRIDE { | 319 const GURL& url, FullscreenExitBubbleType type) override { |
320 fullscreen_ = true; | 320 fullscreen_ = true; |
321 } | 321 } |
322 virtual void ExitFullscreen() OVERRIDE { | 322 virtual void ExitFullscreen() override { |
323 fullscreen_ = false; | 323 fullscreen_ = false; |
324 } | 324 } |
325 | 325 |
326 private: | 326 private: |
327 bool fullscreen_; | 327 bool fullscreen_; |
328 | 328 |
329 DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow); | 329 DISALLOW_COPY_AND_ASSIGN(FullscreenTestBrowserWindow); |
330 }; | 330 }; |
331 | 331 |
332 // Test that uses FullscreenTestBrowserWindow for its window. | 332 // Test that uses FullscreenTestBrowserWindow for its window. |
333 class BrowserCommandControllerFullscreenTest | 333 class BrowserCommandControllerFullscreenTest |
334 : public BrowserWithTestWindowTest { | 334 : public BrowserWithTestWindowTest { |
335 public: | 335 public: |
336 BrowserCommandControllerFullscreenTest() {} | 336 BrowserCommandControllerFullscreenTest() {} |
337 virtual ~BrowserCommandControllerFullscreenTest() {} | 337 virtual ~BrowserCommandControllerFullscreenTest() {} |
338 | 338 |
339 // BrowserWithTestWindowTest overrides: | 339 // BrowserWithTestWindowTest overrides: |
340 virtual BrowserWindow* CreateBrowserWindow() OVERRIDE { | 340 virtual BrowserWindow* CreateBrowserWindow() override { |
341 return new FullscreenTestBrowserWindow; | 341 return new FullscreenTestBrowserWindow; |
342 } | 342 } |
343 | 343 |
344 private: | 344 private: |
345 DISALLOW_COPY_AND_ASSIGN(BrowserCommandControllerFullscreenTest); | 345 DISALLOW_COPY_AND_ASSIGN(BrowserCommandControllerFullscreenTest); |
346 }; | 346 }; |
347 | 347 |
348 TEST_F(BrowserCommandControllerFullscreenTest, | 348 TEST_F(BrowserCommandControllerFullscreenTest, |
349 UpdateCommandsForFullscreenMode) { | 349 UpdateCommandsForFullscreenMode) { |
350 // Defaults for a tabbed browser. | 350 // Defaults for a tabbed browser. |
(...skipping 104 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 455 |
456 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { | 456 TEST_F(BrowserCommandControllerTest, OnSigninAllowedPrefChange) { |
457 chrome::BrowserCommandController command_controller(browser()); | 457 chrome::BrowserCommandController command_controller(browser()); |
458 const CommandUpdater* command_updater = command_controller.command_updater(); | 458 const CommandUpdater* command_updater = command_controller.command_updater(); |
459 | 459 |
460 // Check that the SYNC_SETUP command is updated on preference change. | 460 // Check that the SYNC_SETUP command is updated on preference change. |
461 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 461 EXPECT_TRUE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
462 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); | 462 profile()->GetPrefs()->SetBoolean(prefs::kSigninAllowed, false); |
463 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); | 463 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_SHOW_SYNC_SETUP)); |
464 } | 464 } |
OLD | NEW |