Chromium Code Reviews| Index: content/browser/device_orientation/device_orientation_browsertest.cc |
| diff --git a/content/browser/device_orientation/device_orientation_browsertest.cc b/content/browser/device_orientation/device_orientation_browsertest.cc |
| index 346d59206b1440ce8adf3ca3e08ad09fea85b8c7..373680d17a34e5a947250c7c4023c9cebd35791c 100644 |
| --- a/content/browser/device_orientation/device_orientation_browsertest.cc |
| +++ b/content/browser/device_orientation/device_orientation_browsertest.cc |
| @@ -5,10 +5,12 @@ |
| #include "base/command_line.h" |
| #include "base/file_path.h" |
| #include "base/memory/ref_counted.h" |
| +#include "base/memory/scoped_ptr.h" |
| #include "chrome/browser/ui/browser.h" |
| #include "chrome/browser/ui/browser_tabstrip.h" |
| #include "chrome/test/base/in_process_browser_test.h" |
| #include "chrome/test/base/ui_test_utils.h" |
| +#include "content/browser/device_orientation/device_data.h" |
| #include "content/browser/device_orientation/orientation.h" |
| #include "content/browser/device_orientation/provider.h" |
| #include "content/public/browser/web_contents.h" |
| @@ -18,20 +20,24 @@ namespace device_orientation { |
| class MockProvider : public Provider { |
| public: |
| - explicit MockProvider(const Orientation& orientation) |
| - : orientation_(orientation), |
| + explicit MockProvider(const Orientation* orientation, |
|
hans
2012/07/18 17:21:02
no need for explicit here
aousterh
2012/07/20 11:18:52
Done. Also changed orientation->device data so tha
|
| + DeviceData::Type device_data_type) |
| + : device_data_type_(device_data_type), |
| added_observer_(false), |
| - removed_observer_(false) {} |
| + removed_observer_(false) { |
| + orientation_.reset(orientation); |
| + } |
| virtual void AddObserver(Observer* observer) { |
| added_observer_ = true; |
| - observer->OnOrientationUpdate(orientation_); |
| + observer->OnDeviceDataUpdate(orientation_.get(), device_data_type_); |
| } |
| virtual void RemoveObserver(Observer* observer) { |
| removed_observer_ = true; |
| } |
| - Orientation orientation_; |
| + scoped_ptr<const Orientation> orientation_; |
|
aousterh
2012/07/20 11:18:52
Changing this to device_data_ instead of orientati
|
| + DeviceData::Type device_data_type_; |
| bool added_observer_; |
| bool removed_observer_; |
| @@ -54,12 +60,13 @@ class DeviceOrientationBrowserTest : public InProcessBrowserTest { |
| // crbug.com/113952 |
| IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { |
| - Orientation test_orientation; |
| - test_orientation.set_alpha(1); |
| - test_orientation.set_beta(2); |
| - test_orientation.set_gamma(3); |
| - test_orientation.set_absolute(true); |
| - scoped_refptr<MockProvider> provider(new MockProvider(test_orientation)); |
| + scoped_ptr<Orientation> test_orientation(new Orientation()); |
| + test_orientation->set_alpha(1); |
| + test_orientation->set_beta(2); |
| + test_orientation->set_gamma(3); |
| + test_orientation->set_absolute(true); |
| + scoped_refptr<MockProvider> provider(new MockProvider( |
| + test_orientation.release(), DeviceData::kTypeOrientation)); |
| Provider::SetInstanceForTests(provider.get()); |
| // The test page will register an event handler for orientation events, |