OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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" |
11 #include "content/browser/device_orientation/orientation.h" | 11 #include "content/browser/device_orientation/orientation.h" |
12 #include "content/browser/device_orientation/provider.h" | 12 #include "content/browser/device_orientation/provider.h" |
13 #include "content/browser/tab_contents/tab_contents.h" | 13 #include "content/public/browser/web_contents.h" |
14 #include "content/public/common/content_switches.h" | 14 #include "content/public/common/content_switches.h" |
15 | 15 |
16 namespace device_orientation { | 16 namespace device_orientation { |
17 | 17 |
18 class MockProvider : public Provider { | 18 class MockProvider : public Provider { |
19 public: | 19 public: |
20 explicit MockProvider(const Orientation& orientation) | 20 explicit MockProvider(const Orientation& orientation) |
21 : orientation_(orientation), | 21 : orientation_(orientation), |
22 added_observer_(false), | 22 added_observer_(false), |
23 removed_observer_(false) {} | 23 removed_observer_(false) {} |
(...skipping 31 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
55 // The test page will register an event handler for orientation events, | 55 // The test page will register an event handler for orientation events, |
56 // expects to get an event with kTestOrientation orientation, | 56 // expects to get an event with kTestOrientation orientation, |
57 // then removes the event handler and navigates to #pass. | 57 // then removes the event handler and navigates to #pass. |
58 GURL test_url = testUrl(FILE_PATH_LITERAL("device_orientation_test.html")); | 58 GURL test_url = testUrl(FILE_PATH_LITERAL("device_orientation_test.html")); |
59 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), | 59 ui_test_utils::NavigateToURLBlockUntilNavigationsComplete(browser(), |
60 test_url, | 60 test_url, |
61 2); | 61 2); |
62 | 62 |
63 // Check that the page got the event it expected and that the provider | 63 // Check that the page got the event it expected and that the provider |
64 // saw requests for adding and removing an observer. | 64 // saw requests for adding and removing an observer. |
65 EXPECT_EQ("pass", browser()->GetSelectedTabContents()->GetURL().ref()); | 65 EXPECT_EQ("pass", browser()->GetSelectedWebContents()->GetURL().ref()); |
66 EXPECT_TRUE(provider->added_observer_); | 66 EXPECT_TRUE(provider->added_observer_); |
67 EXPECT_TRUE(provider->removed_observer_); | 67 EXPECT_TRUE(provider->removed_observer_); |
68 } | 68 } |
69 | 69 |
70 } // namespace device_orientation | 70 } // namespace device_orientation |
OLD | NEW |