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/app/chrome_command_ids.h" | 5 #include "chrome/app/chrome_command_ids.h" |
6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" | 6 #include "chrome/browser/bookmarks/bookmark_model_factory.h" |
7 #include "chrome/browser/chrome_page_zoom.h" | 7 #include "chrome/browser/chrome_page_zoom.h" |
8 #include "chrome/browser/ui/browser_command_controller.h" | 8 #include "chrome/browser/ui/browser_command_controller.h" |
9 #include "chrome/browser/ui/browser_commands.h" | 9 #include "chrome/browser/ui/browser_commands.h" |
10 #include "chrome/browser/ui/browser_finder.h" | 10 #include "chrome/browser/ui/browser_finder.h" |
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
278 TabStripModel* tab_strip_model = browser()->tab_strip_model(); | 278 TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
279 | 279 |
280 GURL url("http://www.google.com"); | 280 GURL url("http://www.google.com"); |
281 AddTab(browser(), url); | 281 AddTab(browser(), url); |
282 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0); | 282 content::WebContents* contents1 = tab_strip_model->GetWebContentsAt(0); |
283 | 283 |
284 // Change the zoom percentage to 100. | 284 // Change the zoom percentage to 100. |
285 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_RESET); | 285 chrome_page_zoom::Zoom(contents1, content::PAGE_ZOOM_RESET); |
286 | 286 |
287 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1); | 287 ZoomController* zoom_controller = ZoomController::FromWebContents(contents1); |
288 EXPECT_EQ(zoom_controller->GetZoomPercent(), 100.0f); | 288 EXPECT_EQ(zoom_controller->GetZoomPercent(), |
| 289 zoom_controller->GetDefaultZoomPercent()); |
289 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); | 290 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); |
290 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); | 291 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); |
291 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); | 292 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); |
292 } | 293 } |
293 | 294 |
294 TEST_F(BrowserCommandsTest, OnZoomLevelChanged) { | 295 TEST_F(BrowserCommandsTest, OnZoomLevelChanged) { |
295 TabStripModel* tab_strip_model = browser()->tab_strip_model(); | 296 TabStripModel* tab_strip_model = browser()->tab_strip_model(); |
296 | 297 |
297 GURL url("http://www.google.com"); | 298 GURL url("http://www.google.com"); |
298 AddTab(browser(), url); | 299 AddTab(browser(), url); |
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
332 tab_strip_model->ActivateTabAt(1, true); | 333 tab_strip_model->ActivateTabAt(1, true); |
333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); | 334 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); |
334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT); | 335 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT); |
335 | 336 |
336 zoom_controller = ZoomController::FromWebContents(contents2); | 337 zoom_controller = ZoomController::FromWebContents(contents2); |
337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f); | 338 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f); |
338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); | 339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); |
339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); | 340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); |
340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); | 341 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); |
341 } | 342 } |
OLD | NEW |