Index: chrome/browser/ui/gtk/location_bar_view_gtk_browsertest.cc |
diff --git a/chrome/browser/ui/gtk/location_bar_view_gtk_browsertest.cc b/chrome/browser/ui/gtk/location_bar_view_gtk_browsertest.cc |
index 19226fec87b0b3285a39a1ff3e67ca10ba077e8d..75f51ae67afe1b14a0a23a6e5046b97d2a72cb50 100644 |
--- a/chrome/browser/ui/gtk/location_bar_view_gtk_browsertest.cc |
+++ b/chrome/browser/ui/gtk/location_bar_view_gtk_browsertest.cc |
@@ -5,6 +5,7 @@ |
#include <gtk/gtk.h> |
#include "base/string_number_conversions.h" |
+#include "chrome/browser/profiles/profile.h" |
#include "chrome/browser/ui/browser.h" |
#include "chrome/browser/ui/browser_commands.h" |
#include "chrome/browser/ui/browser_tabstrip.h" |
@@ -16,6 +17,7 @@ |
#include "chrome/browser/ui/zoom/zoom_controller.h" |
#include "chrome/test/base/in_process_browser_test.h" |
#include "chrome/test/base/ui_test_utils.h" |
+#include "content/public/browser/host_zoom_map.h" |
#include "content/public/browser/notification_service.h" |
#include "content/public/browser/notification_types.h" |
#include "content/public/browser/web_contents.h" |
@@ -44,8 +46,13 @@ void ExpectAtDefaultZoom(content::WebContents* contents) { |
EXPECT_EQ(GetZoomPercent(contents), 100); |
} |
+void OnZoomLevelChanged(const base::Closure& callback, |
+ const std::string& host) { |
+ callback.Run(); |
} |
+} // namespace |
+ |
class LocationBarViewGtkZoomTest : public InProcessBrowserTest { |
public: |
LocationBarViewGtkZoomTest() {} |
@@ -98,11 +105,17 @@ class LocationBarViewGtkZoomTest : public InProcessBrowserTest { |
} |
void WaitForZoom(content::PageZoom zoom_action) { |
- content::WindowedNotificationObserver zoom_observer( |
- content::NOTIFICATION_ZOOM_LEVEL_CHANGED, |
- content::NotificationService::AllSources()); |
+ scoped_refptr<content::MessageLoopRunner> loop_runner( |
+ new content::MessageLoopRunner); |
+ |
+ content::HostZoomMap::GetForBrowserContext( |
+ browser()->profile())->AddZoomLevelChangedCallback( |
+ base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); |
chrome::Zoom(browser(), zoom_action); |
- zoom_observer.Wait(); |
+ loop_runner->Run(); |
+ content::HostZoomMap::GetForBrowserContext( |
+ browser()->profile())->RemoveZoomLevelChangedCallback( |
+ base::Bind(&OnZoomLevelChanged, loop_runner->QuitClosure())); |
} |
DISALLOW_COPY_AND_ASSIGN(LocationBarViewGtkZoomTest); |