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

Side by Side Diff: chrome/browser/browser_commands_unittest.cc

Issue 678343002: Default zoom was never read from chrome://settings (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Uses IsAtDefaultZoom() to see whether a tab zoom has been reset Created 6 years, 1 month 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 unified diff | Download patch
OLDNEW
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
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(), 100.f);
289 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); 289 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
290 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); 290 EXPECT_FALSE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
291 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); 291 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
292 } 292 }
293 293
294 TEST_F(BrowserCommandsTest, OnZoomLevelChanged) { 294 TEST_F(BrowserCommandsTest, OnZoomLevelChanged) {
295 TabStripModel* tab_strip_model = browser()->tab_strip_model(); 295 TabStripModel* tab_strip_model = browser()->tab_strip_model();
296 296
297 GURL url("http://www.google.com"); 297 GURL url("http://www.google.com");
298 AddTab(browser(), url); 298 AddTab(browser(), url);
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
332 tab_strip_model->ActivateTabAt(1, true); 332 tab_strip_model->ActivateTabAt(1, true);
333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1)); 333 EXPECT_TRUE(tab_strip_model->IsTabSelected(1));
334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT); 334 chrome_page_zoom::Zoom(contents2, content::PAGE_ZOOM_OUT);
335 335
336 zoom_controller = ZoomController::FromWebContents(contents2); 336 zoom_controller = ZoomController::FromWebContents(contents2);
337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f); 337 EXPECT_EQ(zoom_controller->GetZoomPercent(), 90.0f);
338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS)); 338 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_PLUS));
339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL)); 339 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_NORMAL));
340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS)); 340 EXPECT_TRUE(chrome::IsCommandEnabled(browser(), IDC_ZOOM_MINUS));
341 } 341 }
OLDNEW
« no previous file with comments | « no previous file | chrome/browser/ui/browser_commands.cc » ('j') | chrome/browser/ui/browser_commands.cc » ('J')

Powered by Google App Engine
This is Rietveld 408576698