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/files/file_path.h" | 6 #include "base/files/file_path.h" |
7 #include "base/memory/ref_counted.h" | 7 #include "base/memory/ref_counted.h" |
8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
9 #include "content/browser/device_orientation/device_data.h" | 9 #include "content/browser/device_orientation/device_data.h" |
10 #include "content/browser/device_orientation/orientation.h" | 10 #include "content/browser/device_orientation/orientation.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
51 } | 51 } |
52 }; | 52 }; |
53 | 53 |
54 // crbug.com/113952 | 54 // crbug.com/113952 |
55 IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { | 55 IN_PROC_BROWSER_TEST_F(DeviceOrientationBrowserTest, BasicTest) { |
56 scoped_refptr<Orientation> test_orientation(new Orientation()); | 56 scoped_refptr<Orientation> test_orientation(new Orientation()); |
57 test_orientation->set_alpha(1); | 57 test_orientation->set_alpha(1); |
58 test_orientation->set_beta(2); | 58 test_orientation->set_beta(2); |
59 test_orientation->set_gamma(3); | 59 test_orientation->set_gamma(3); |
60 test_orientation->set_absolute(true); | 60 test_orientation->set_absolute(true); |
61 scoped_refptr<MockProvider> provider(new MockProvider( | 61 scoped_refptr<MockProvider> provider( |
62 test_orientation, DeviceData::kTypeOrientation)); | 62 new MockProvider(test_orientation.get(), DeviceData::kTypeOrientation)); |
63 Provider::SetInstanceForTests(provider.get()); | 63 Provider::SetInstanceForTests(provider.get()); |
64 | 64 |
65 // The test page will register an event handler for orientation events, | 65 // The test page will register an event handler for orientation events, |
66 // expects to get an event with kTestOrientation orientation, | 66 // expects to get an event with kTestOrientation orientation, |
67 // then removes the event handler and navigates to #pass. | 67 // then removes the event handler and navigates to #pass. |
68 GURL test_url = GetTestUrl( | 68 GURL test_url = GetTestUrl( |
69 "device_orientation", "device_orientation_test.html"); | 69 "device_orientation", "device_orientation_test.html"); |
70 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); | 70 NavigateToURLBlockUntilNavigationsComplete(shell(), test_url, 2); |
71 | 71 |
72 // Check that the page got the event it expected and that the provider | 72 // Check that the page got the event it expected and that the provider |
73 // saw requests for adding and removing an observer. | 73 // saw requests for adding and removing an observer. |
74 EXPECT_EQ("pass", shell()->web_contents()->GetURL().ref()); | 74 EXPECT_EQ("pass", shell()->web_contents()->GetURL().ref()); |
75 EXPECT_TRUE(provider->added_observer_); | 75 EXPECT_TRUE(provider->added_observer_); |
76 EXPECT_TRUE(provider->removed_observer_); | 76 EXPECT_TRUE(provider->removed_observer_); |
77 } | 77 } |
78 | 78 |
79 } // namespace content | 79 } // namespace content |
OLD | NEW |