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/strings/stringprintf.h" | 5 #include "base/strings/stringprintf.h" |
6 #include "base/win/windows_version.h" | 6 #include "base/win/windows_version.h" |
7 #include "chrome/browser/extensions/extension_apitest.h" | 7 #include "chrome/browser/extensions/extension_apitest.h" |
8 #include "chrome/browser/extensions/extension_service.h" | 8 #include "chrome/browser/extensions/extension_service.h" |
9 #include "chrome/browser/extensions/extension_test_message_listener.h" | 9 #include "chrome/browser/extensions/extension_test_message_listener.h" |
10 #include "chrome/browser/extensions/tab_helper.h" | 10 #include "chrome/browser/extensions/tab_helper.h" |
11 #include "chrome/browser/profiles/profile.h" | 11 #include "chrome/browser/profiles/profile.h" |
| 12 #include "chrome/browser/ui/fullscreen/fullscreen_controller.h" |
12 #include "chrome/common/chrome_switches.h" | 13 #include "chrome/common/chrome_switches.h" |
13 #include "chrome/common/chrome_version_info.h" | 14 #include "chrome/common/chrome_version_info.h" |
14 #include "chrome/common/extensions/feature_switch.h" | 15 #include "chrome/common/extensions/feature_switch.h" |
15 #include "chrome/common/extensions/features/base_feature_provider.h" | 16 #include "chrome/common/extensions/features/base_feature_provider.h" |
16 #include "chrome/common/extensions/features/complex_feature.h" | 17 #include "chrome/common/extensions/features/complex_feature.h" |
17 #include "chrome/common/extensions/features/feature.h" | 18 #include "chrome/common/extensions/features/feature.h" |
18 #include "chrome/common/extensions/features/simple_feature.h" | 19 #include "chrome/common/extensions/features/simple_feature.h" |
19 #include "content/public/browser/render_process_host.h" | 20 #include "content/public/browser/render_process_host.h" |
20 #include "content/public/browser/render_view_host.h" | 21 #include "content/public/browser/render_view_host.h" |
21 #include "content/public/common/content_switches.h" | 22 #include "content/public/common/content_switches.h" |
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
156 // Add extension to whitelist and make sure capture succeeds. | 157 // Add extension to whitelist and make sure capture succeeds. |
157 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); | 158 EXPECT_TRUE(before_whitelist_extension.WaitUntilSatisfied()); |
158 AddExtensionToCommandLineWhitelist(); | 159 AddExtensionToCommandLineWhitelist(); |
159 before_whitelist_extension.Reply(""); | 160 before_whitelist_extension.Reply(""); |
160 | 161 |
161 ResultCatcher catcher; | 162 ResultCatcher catcher; |
162 catcher.RestrictToProfile(browser()->profile()); | 163 catcher.RestrictToProfile(browser()->profile()); |
163 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); | 164 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
164 } | 165 } |
165 | 166 |
| 167 IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, FullscreenEvents) { |
| 168 AddExtensionToCommandLineWhitelist(); |
| 169 |
| 170 content::OpenURLParams params(GURL("chrome://version"), |
| 171 content::Referrer(), |
| 172 CURRENT_TAB, |
| 173 content::PAGE_TRANSITION_LINK, false); |
| 174 content::WebContents* web_contents = browser()->OpenURL(params); |
| 175 |
| 176 ExtensionTestMessageListener listeners_setup("ready1", true); |
| 177 ExtensionTestMessageListener fullscreen_entered("ready2", true); |
| 178 |
| 179 ASSERT_TRUE(RunExtensionSubtest("tab_capture/experimental", |
| 180 "fullscreen_test.html")) << message_; |
| 181 EXPECT_TRUE(listeners_setup.WaitUntilSatisfied()); |
| 182 |
| 183 // Toggle fullscreen after setting up listeners. |
| 184 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, |
| 185 true); |
| 186 listeners_setup.Reply(""); |
| 187 |
| 188 // Toggle again after JS should have the event. |
| 189 EXPECT_TRUE(fullscreen_entered.WaitUntilSatisfied()); |
| 190 browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents, |
| 191 false); |
| 192 fullscreen_entered.Reply(""); |
| 193 |
| 194 ResultCatcher catcher; |
| 195 catcher.RestrictToProfile(browser()->profile()); |
| 196 EXPECT_TRUE(catcher.GetNextResult()) << catcher.message(); |
| 197 } |
| 198 |
166 } // namespace chrome | 199 } // namespace chrome |
OLD | NEW |