| OLD | NEW |
| 1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2013 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/auto_reset.h" | 5 #include "base/auto_reset.h" |
| 6 #include "chrome/browser/chrome_page_zoom.h" | 6 #include "chrome/browser/chrome_page_zoom.h" |
| 7 #include "chrome/browser/profiles/profile.h" | 7 #include "chrome/browser/profiles/profile.h" |
| 8 #include "chrome/browser/ui/browser_window.h" | 8 #include "chrome/browser/ui/browser_window.h" |
| 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" | 9 #import "chrome/browser/ui/cocoa/browser_window_controller.h" |
| 10 #import "chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h" | 10 #import "chrome/browser/ui/cocoa/browser/zoom_bubble_controller.h" |
| 11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" | 11 #import "chrome/browser/ui/cocoa/location_bar/location_bar_view_mac.h" |
| 12 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" | 12 #import "chrome/browser/ui/cocoa/location_bar/zoom_decoration.h" |
| 13 #include "chrome/browser/ui/cocoa/run_loop_testing.h" | 13 #include "chrome/browser/ui/cocoa/run_loop_testing.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
| 15 #include "chrome/browser/ui/toolbar/test_toolbar_model.h" | 15 #include "chrome/browser/ui/toolbar/test_toolbar_model.h" |
| 16 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
| 17 #include "content/public/browser/host_zoom_map.h" | 17 #include "content/public/browser/host_zoom_map.h" |
| 18 #include "content/public/test/test_utils.h" | 18 #include "content/public/test/test_utils.h" |
| 19 | 19 |
| 20 class ZoomDecorationTest : public InProcessBrowserTest { | 20 class ZoomDecorationTest : public InProcessBrowserTest { |
| 21 protected: | 21 protected: |
| 22 ZoomDecorationTest() | 22 ZoomDecorationTest() |
| 23 : InProcessBrowserTest(), | 23 : InProcessBrowserTest(), |
| 24 should_quit_on_zoom_(false) { | 24 should_quit_on_zoom_(false) { |
| 25 } | 25 } |
| 26 | 26 |
| 27 virtual void SetUpOnMainThread() OVERRIDE { | 27 virtual void SetUpOnMainThread() OVERRIDE { |
| 28 zoom_subscription_ = content::HostZoomMap::GetForBrowserContext( | 28 zoom_subscription_ = content::HostZoomMap::GetDefaultForBrowserContext( |
| 29 browser()->profile())->AddZoomLevelChangedCallback( | 29 browser()->profile())->AddZoomLevelChangedCallback( |
| 30 base::Bind(&ZoomDecorationTest::OnZoomChanged, | 30 base::Bind(&ZoomDecorationTest::OnZoomChanged, |
| 31 base::Unretained(this))); | 31 base::Unretained(this))); |
| 32 } | 32 } |
| 33 | 33 |
| 34 virtual void TearDownOnMainThread() OVERRIDE { | 34 virtual void TearDownOnMainThread() OVERRIDE { |
| 35 zoom_subscription_.reset(); | 35 zoom_subscription_.reset(); |
| 36 } | 36 } |
| 37 | 37 |
| 38 LocationBarViewMac* GetLocationBar() const { | 38 LocationBarViewMac* GetLocationBar() const { |
| (...skipping 79 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 118 | 118 |
| 119 // Create a new browser so that it can be closed properly. | 119 // Create a new browser so that it can be closed properly. |
| 120 Browser* browser2 = CreateBrowser(browser()->profile()); | 120 Browser* browser2 = CreateBrowser(browser()->profile()); |
| 121 ZoomDecoration* zoom_decoration = GetZoomDecorationForBrowser(browser2); | 121 ZoomDecoration* zoom_decoration = GetZoomDecorationForBrowser(browser2); |
| 122 zoom_decoration->ShowBubble(true); | 122 zoom_decoration->ShowBubble(true); |
| 123 | 123 |
| 124 // Test shouldn't crash. | 124 // Test shouldn't crash. |
| 125 browser2->window()->Close(); | 125 browser2->window()->Close(); |
| 126 content::RunAllPendingInMessageLoop(); | 126 content::RunAllPendingInMessageLoop(); |
| 127 } | 127 } |
| OLD | NEW |