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

Side by Side Diff: chrome/browser/ui/browser_browsertest.cc

Issue 8528011: Page zoom improvements (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src/
Patch Set: Tweak, Tweak Created 9 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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 <string> 5 #include <string>
6 6
7 #include "base/compiler_specific.h" 7 #include "base/compiler_specific.h"
8 #include "base/file_path.h" 8 #include "base/file_path.h"
9 #if defined(OS_MACOSX) 9 #if defined(OS_MACOSX)
10 #include "base/mac/mac_util.h" 10 #include "base/mac/mac_util.h"
(...skipping 1254 matching lines...) Expand 10 before | Expand all | Expand 10 after
1265 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); 1265 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS));
1266 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); 1266 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
1267 // Set Incognito to AVAILABLE. 1267 // Set Incognito to AVAILABLE.
1268 IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(), 1268 IncognitoModePrefs::SetAvailability(popup_browser->profile()->GetPrefs(),
1269 IncognitoModePrefs::ENABLED); 1269 IncognitoModePrefs::ENABLED);
1270 // OPTIONS and IMPORT_SETTINGS are still disabled since it is a non-normal UI. 1270 // OPTIONS and IMPORT_SETTINGS are still disabled since it is a non-normal UI.
1271 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS)); 1271 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_OPTIONS));
1272 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS)); 1272 EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
1273 } 1273 }
1274 1274
1275 IN_PROC_BROWSER_TEST_F(BrowserTest, PageZoom) {
1276 TabContents* contents = browser()->GetSelectedTabContents();
1277 bool enable_plus, enable_minus;
1278
1279 ui_test_utils::WindowedNotificationObserver zoom_in_observer(
1280 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1281 content::NotificationService::AllSources());
1282 browser()->Zoom(content::PAGE_ZOOM_IN);
1283 zoom_in_observer.Wait();
1284 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110);
1285 EXPECT_TRUE(enable_plus);
1286 EXPECT_TRUE(enable_minus);
1287
1288 ui_test_utils::WindowedNotificationObserver zoom_reset_observer(
1289 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1290 content::NotificationService::AllSources());
1291 browser()->Zoom(content::PAGE_ZOOM_RESET);
1292 zoom_reset_observer.Wait();
1293 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100);
1294 EXPECT_TRUE(enable_plus);
1295 EXPECT_TRUE(enable_minus);
1296
1297 ui_test_utils::WindowedNotificationObserver zoom_out_observer(
1298 content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
1299 content::NotificationService::AllSources());
1300 browser()->Zoom(content::PAGE_ZOOM_OUT);
1301 zoom_out_observer.Wait();
1302 EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90);
1303 EXPECT_TRUE(enable_plus);
1304 EXPECT_TRUE(enable_minus);
1305
1306 browser()->Zoom(content::PAGE_ZOOM_RESET);
1307 }
1308
1275 // TODO(ben): this test was never enabled. It has bit-rotted since being added. 1309 // TODO(ben): this test was never enabled. It has bit-rotted since being added.
1276 // It originally lived in browser_unittest.cc, but has been moved here to make 1310 // It originally lived in browser_unittest.cc, but has been moved here to make
1277 // room for real browser unit tests. 1311 // room for real browser unit tests.
1278 #if 0 1312 #if 0
1279 class BrowserTest2 : public InProcessBrowserTest { 1313 class BrowserTest2 : public InProcessBrowserTest {
1280 public: 1314 public:
1281 BrowserTest2() { 1315 BrowserTest2() {
1282 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL); 1316 host_resolver_proc_ = new net::RuleBasedHostResolverProc(NULL);
1283 // Avoid making external DNS lookups. In this test we don't need this 1317 // Avoid making external DNS lookups. In this test we don't need this
1284 // to succeed. 1318 // to succeed.
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after
1349 1383
1350 // The normal browser should now have four. 1384 // The normal browser should now have four.
1351 EXPECT_EQ(4, browser()->tab_count()); 1385 EXPECT_EQ(4, browser()->tab_count());
1352 1386
1353 // Close the additional browsers. 1387 // Close the additional browsers.
1354 popup_browser->CloseAllTabs(); 1388 popup_browser->CloseAllTabs();
1355 app_browser->CloseAllTabs(); 1389 app_browser->CloseAllTabs();
1356 app_popup_browser->CloseAllTabs(); 1390 app_popup_browser->CloseAllTabs();
1357 } 1391 }
1358 #endif 1392 #endif
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698