OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #include "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/file_path.h" | 6 #include "base/file_path.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "chrome/browser/ui/browser.h" | 8 #include "chrome/browser/ui/browser.h" |
9 #include "chrome/test/base/in_process_browser_test.h" | 9 #include "chrome/test/base/in_process_browser_test.h" |
10 #include "chrome/test/base/ui_test_utils.h" | 10 #include "chrome/test/base/ui_test_utils.h" |
(...skipping 11 matching lines...) Expand all Loading... |
22 added_observer_(false), | 22 added_observer_(false), |
23 removed_observer_(false) {} | 23 removed_observer_(false) {} |
24 | 24 |
25 virtual void AddObserver(Observer* observer) { | 25 virtual void AddObserver(Observer* observer) { |
26 added_observer_ = true; | 26 added_observer_ = true; |
27 observer->OnOrientationUpdate(orientation_); | 27 observer->OnOrientationUpdate(orientation_); |
28 } | 28 } |
29 virtual void RemoveObserver(Observer* observer) { | 29 virtual void RemoveObserver(Observer* observer) { |
30 removed_observer_ = true; | 30 removed_observer_ = true; |
31 } | 31 } |
| 32 |
32 Orientation orientation_; | 33 Orientation orientation_; |
33 bool added_observer_; | 34 bool added_observer_; |
34 bool removed_observer_; | 35 bool removed_observer_; |
| 36 |
| 37 private: |
| 38 virtual ~MockProvider() {} |
35 }; | 39 }; |
36 | 40 |
37 class DeviceOrientationBrowserTest : public InProcessBrowserTest { | 41 class DeviceOrientationBrowserTest : public InProcessBrowserTest { |
38 public: | 42 public: |
39 // From InProcessBrowserTest. | 43 // From InProcessBrowserTest. |
40 virtual void SetUpCommandLine(CommandLine* command_line) { | 44 virtual void SetUpCommandLine(CommandLine* command_line) { |
41 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation)); | 45 EXPECT_TRUE(!command_line->HasSwitch(switches::kDisableDeviceOrientation)); |
42 } | 46 } |
43 | 47 |
44 GURL testUrl(const FilePath::CharType* filename) { | 48 GURL testUrl(const FilePath::CharType* filename) { |
(...skipping 17 matching lines...) Expand all Loading... |
62 2); | 66 2); |
63 | 67 |
64 // Check that the page got the event it expected and that the provider | 68 // Check that the page got the event it expected and that the provider |
65 // saw requests for adding and removing an observer. | 69 // saw requests for adding and removing an observer. |
66 EXPECT_EQ("pass", browser()->GetSelectedWebContents()->GetURL().ref()); | 70 EXPECT_EQ("pass", browser()->GetSelectedWebContents()->GetURL().ref()); |
67 EXPECT_TRUE(provider->added_observer_); | 71 EXPECT_TRUE(provider->added_observer_); |
68 EXPECT_TRUE(provider->removed_observer_); | 72 EXPECT_TRUE(provider->removed_observer_); |
69 } | 73 } |
70 | 74 |
71 } // namespace device_orientation | 75 } // namespace device_orientation |
OLD | NEW |