| Index: chrome/browser/ui/browser_browsertest.cc
|
| diff --git a/chrome/browser/ui/browser_browsertest.cc b/chrome/browser/ui/browser_browsertest.cc
|
| index d20a286ee04357cb9b99f466b0710b479a6e8300..c5d9a11ebaf5a1f471b45e3bada2b4f04898f5f7 100644
|
| --- a/chrome/browser/ui/browser_browsertest.cc
|
| +++ b/chrome/browser/ui/browser_browsertest.cc
|
| @@ -49,11 +49,10 @@
|
| #include "chrome/test/base/in_process_browser_test.h"
|
| #include "chrome/test/base/ui_test_utils.h"
|
| #include "content/public/browser/favicon_status.h"
|
| +#include "content/public/browser/host_zoom_map.h"
|
| #include "content/public/browser/interstitial_page.h"
|
| #include "content/public/browser/interstitial_page_delegate.h"
|
| #include "content/public/browser/navigation_entry.h"
|
| -#include "content/public/browser/notification_service.h"
|
| -#include "content/public/browser/notification_source.h"
|
| #include "content/public/browser/render_process_host.h"
|
| #include "content/public/browser/render_view_host.h"
|
| #include "content/public/browser/render_widget_host_view.h"
|
| @@ -1316,6 +1315,28 @@ IN_PROC_BROWSER_TEST_F(BrowserTest,
|
| EXPECT_FALSE(command_updater->IsCommandEnabled(IDC_IMPORT_SETTINGS));
|
| }
|
|
|
| +namespace {
|
| +
|
| +class PageZoomObserver : public content::HostZoomMap::Observer {
|
| + public:
|
| + PageZoomObserver(content::HostZoomMap* map,
|
| + const base::Closure& callback)
|
| + : content::HostZoomMap::Observer(map),
|
| + callback_(callback) {
|
| + }
|
| +
|
| + virtual void OnZoomLevelChanged(const std::string& host) OVERRIDE {
|
| + callback_.Run();
|
| + }
|
| +
|
| + private:
|
| + base::Closure callback_;
|
| +
|
| + DISALLOW_COPY_AND_ASSIGN(PageZoomObserver);
|
| +};
|
| +
|
| +} // namespace
|
| +
|
| #if defined(OS_WIN)
|
| // Flakes regularly on Windows XP
|
| // http://crbug.com/146040
|
| @@ -1327,32 +1348,44 @@ IN_PROC_BROWSER_TEST_F(BrowserTest, MAYBE_PageZoom) {
|
| WebContents* contents = browser()->tab_strip_model()->GetActiveWebContents();
|
| bool enable_plus, enable_minus;
|
|
|
| - content::WindowedNotificationObserver zoom_in_observer(
|
| - content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
|
| - content::NotificationService::AllSources());
|
| - chrome::Zoom(browser(), content::PAGE_ZOOM_IN);
|
| - zoom_in_observer.Wait();
|
| - EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110);
|
| - EXPECT_TRUE(enable_plus);
|
| - EXPECT_TRUE(enable_minus);
|
| -
|
| - content::WindowedNotificationObserver zoom_reset_observer(
|
| - content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
|
| - content::NotificationService::AllSources());
|
| - chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
|
| - zoom_reset_observer.Wait();
|
| - EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100);
|
| - EXPECT_TRUE(enable_plus);
|
| - EXPECT_TRUE(enable_minus);
|
| + {
|
| + scoped_refptr<content::MessageLoopRunner> loop_runner(
|
| + new content::MessageLoopRunner);
|
| + PageZoomObserver zoom_observer(
|
| + content::HostZoomMap::GetForBrowserContext(browser()->profile()),
|
| + loop_runner->QuitClosure());
|
| + chrome::Zoom(browser(), content::PAGE_ZOOM_IN);
|
| + loop_runner->Run();
|
| + EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 110);
|
| + EXPECT_TRUE(enable_plus);
|
| + EXPECT_TRUE(enable_minus);
|
| + }
|
|
|
| - content::WindowedNotificationObserver zoom_out_observer(
|
| - content::NOTIFICATION_ZOOM_LEVEL_CHANGED,
|
| - content::NotificationService::AllSources());
|
| - chrome::Zoom(browser(), content::PAGE_ZOOM_OUT);
|
| - zoom_out_observer.Wait();
|
| - EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90);
|
| - EXPECT_TRUE(enable_plus);
|
| - EXPECT_TRUE(enable_minus);
|
| + {
|
| + scoped_refptr<content::MessageLoopRunner> loop_runner(
|
| + new content::MessageLoopRunner);
|
| + PageZoomObserver zoom_observer(
|
| + content::HostZoomMap::GetForBrowserContext(browser()->profile()),
|
| + loop_runner->QuitClosure());
|
| + chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
|
| + loop_runner->Run();
|
| + EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 100);
|
| + EXPECT_TRUE(enable_plus);
|
| + EXPECT_TRUE(enable_minus);
|
| + }
|
| +
|
| + {
|
| + scoped_refptr<content::MessageLoopRunner> loop_runner(
|
| + new content::MessageLoopRunner);
|
| + PageZoomObserver zoom_observer(
|
| + content::HostZoomMap::GetForBrowserContext(browser()->profile()),
|
| + loop_runner->QuitClosure());
|
| + chrome::Zoom(browser(), content::PAGE_ZOOM_OUT);
|
| + loop_runner->Run();
|
| + EXPECT_EQ(contents->GetZoomPercent(&enable_plus, &enable_minus), 90);
|
| + EXPECT_TRUE(enable_plus);
|
| + EXPECT_TRUE(enable_minus);
|
| + }
|
|
|
| chrome::Zoom(browser(), content::PAGE_ZOOM_RESET);
|
| }
|
|
|