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 bbff907dda565e8793d8b3539f8bbe4f78feb353..8270436701edf7c88d49fbc271d1ef0c9d16f137 100644 |
--- a/content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
+++ b/content/renderer/screen_orientation/mock_screen_orientation_controller.cc |
@@ -7,6 +7,7 @@ |
#include "base/bind.h" |
#include "base/logging.h" |
#include "base/message_loop/message_loop.h" |
+#include "content/renderer/render_view_impl.h" |
#include "third_party/WebKit/public/platform/WebScreenOrientationListener.h" |
namespace content { |
@@ -15,7 +16,8 @@ MockScreenOrientationController::MockScreenOrientationController() |
: current_lock_(blink::WebScreenOrientationLockDefault), |
device_orientation_(blink::WebScreenOrientationPortraitPrimary), |
current_orientation_(blink::WebScreenOrientationPortraitPrimary), |
- listener_(NULL) { |
+ listener_(NULL), |
+ render_view_(NULL) { |
// Since MockScreenOrientationController is held by LazyInstance reference, |
// add this ref for it. |
AddRef(); |
@@ -30,6 +32,7 @@ void MockScreenOrientationController::SetListener( |
} |
void MockScreenOrientationController::ResetData() { |
+ render_view_ = 0; |
current_lock_ = blink::WebScreenOrientationLockDefault; |
device_orientation_ = blink::WebScreenOrientationPortraitPrimary; |
current_orientation_ = blink::WebScreenOrientationPortraitPrimary; |
@@ -64,7 +67,12 @@ void MockScreenOrientationController::ResetLockSync() { |
} |
void MockScreenOrientationController::UpdateDeviceOrientation( |
+ RenderView* render_view, |
blink::WebScreenOrientationType orientation) { |
+ // Make sure that render_view_ did not change during test. |
+ assert(!render_view_ || render_view_ == render_view); |
jochen (gone - plz use gerrit)
2014/06/02 07:21:25
DCHECK
ostap
2014/06/03 00:11:54
Done.
|
+ render_view_ = render_view; |
+ |
if (device_orientation_ == orientation) |
return; |
device_orientation_ = orientation; |
@@ -78,6 +86,9 @@ void MockScreenOrientationController::UpdateScreenOrientation( |
if (current_orientation_ == orientation) |
return; |
current_orientation_ = orientation; |
+ if (render_view_) |
jochen (gone - plz use gerrit)
2014/06/02 07:21:25
nit. add { } because of > 1line body
ostap
2014/06/03 00:11:54
Done.
|
+ static_cast<RenderViewImpl*>(render_view_) |
jochen (gone - plz use gerrit)
2014/06/02 07:21:25
how can you guarantee that e.g. the render view di
ostap
2014/06/03 00:11:54
At previous patches I did call from ~RenderViewImp
|
+ ->SetScreenOrientationForTesting(orientation); |
if (listener_) |
listener_->didChangeScreenOrientation(current_orientation_); |
} |