Index: content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
diff --git a/content/renderer/screen_orientation/mock_screen_orientation_controller.cc b/content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
index d16bc74e38d484a85ae12d069d94b877f7bbdace..0b74481318dfe404d35f50bdce114f9450370248 100644 |
--- a/content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
+++ b/content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
@@ -5,6 +5,7 @@ |
#include "content/renderer/screen_orientation/mock_screen_orientation_controller.h" |
#include "base/logging.h" |
+#include "content/renderer/render_view_impl.h" |
#include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" |
namespace content { |
@@ -13,7 +14,8 @@ MockScreenOrientationController::MockScreenOrientationController() |
: current_lock_(blink::WebScreenOrientationLockDefault), |
device_orientation_(blink::WebScreenOrientationPortraitPrimary), |
current_orientation_(blink::WebScreenOrientationPortraitPrimary), |
- listener_(NULL) { |
+ listener_(NULL), |
+ render_view_(NULL) { |
} |
void MockScreenOrientationController::SetListener( |
@@ -44,7 +46,15 @@ void MockScreenOrientationController::ResetLock() { |
} |
void MockScreenOrientationController::UpdateDeviceOrientation( |
+ RenderView* render_view, |
blink::WebScreenOrientationType orientation) { |
+ if (render_view_) { |
+ // Make sure that render_view_ did not change during test. |
+ assert(render_view_ == render_view); |
+ } else { |
+ render_view_ = render_view; |
+ } |
mlamouri (slow - plz ping)
2014/05/28 13:45:20
I guess you can do:
assert(!render_view_ || rend
ostap
2014/05/28 19:17:05
Done.
|
+ |
if (device_orientation_ == orientation) |
return; |
device_orientation_ = orientation; |
@@ -58,6 +68,9 @@ void MockScreenOrientationController::UpdateScreenOrientation( |
if (current_orientation_ == orientation) |
return; |
current_orientation_ = orientation; |
+ if (render_view_) |
+ static_cast<RenderViewImpl*>(render_view_) |
+ ->SetScreenOrientationForTesting(orientation); |
if (listener_) |
listener_->didChangeScreenOrientation(current_orientation_); |
Inactive
2014/05/28 12:02:20
BTW, we should get rid of the old listener old in
|
} |
@@ -104,4 +117,8 @@ MockScreenOrientationController::SuitableOrientationForCurrentLock() { |
} |
} |
+void MockScreenOrientationController::ResetRenderView() { |
+ render_view_ = 0; |
+} |
+ |
} // namespace content |