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

Unified Diff: components/ui/zoom/zoom_test_utils.cc

Issue 1414643005: Disable zoom bubble for PDF extension. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Convert to pathway common to Mac and non-Mac. Created 5 years, 2 months 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 side-by-side diff with in-line comments
Download patch
Index: components/ui/zoom/zoom_test_utils.cc
diff --git a/components/ui/zoom/zoom_test_utils.cc b/components/ui/zoom/zoom_test_utils.cc
new file mode 100644
index 0000000000000000000000000000000000000000..be8df303e5f6888398acfe116b9275ce18bdba78
--- /dev/null
+++ b/components/ui/zoom/zoom_test_utils.cc
@@ -0,0 +1,43 @@
+// Copyright 2015 The Chromium Authors. All rights reserved.
+// Use of this source code is governed by a BSD-style license that can be
+// found in the LICENSE file.
+
+#include "components/ui/zoom/zoom_test_utils.h"
+
+#include "content/public/test/test_utils.h"
+
+namespace ui_zoom {
+
+bool operator==(const ZoomController::ZoomChangedEventData& lhs,
+ const ZoomController::ZoomChangedEventData& rhs) {
+ return lhs.web_contents == rhs.web_contents &&
+ lhs.old_zoom_level == rhs.old_zoom_level &&
+ lhs.new_zoom_level == rhs.new_zoom_level &&
+ lhs.zoom_mode == rhs.zoom_mode &&
+ lhs.can_show_bubble == rhs.can_show_bubble;
+}
+
+ZoomChangedWatcher::ZoomChangedWatcher(
+ ZoomController* zoom_controller,
+ const ZoomController::ZoomChangedEventData& expected_event_data)
+ : zoom_controller_(zoom_controller),
+ expected_event_data_(expected_event_data),
+ message_loop_runner_(new content::MessageLoopRunner) {
+ zoom_controller_->AddObserver(this);
+ }
+
+ZoomChangedWatcher::~ZoomChangedWatcher() {
+ zoom_controller_->RemoveObserver(this);
+}
+
+void ZoomChangedWatcher::Wait() {
+ message_loop_runner_->Run();
+}
+
+void ZoomChangedWatcher::OnZoomChanged(
+ const ZoomController::ZoomChangedEventData& event_data) {
+ if (event_data == expected_event_data_)
+ message_loop_runner_->Quit();
+}
+
+} // namespace ui_zoom

Powered by Google App Engine
This is Rietveld 408576698