Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(934)

Unified Diff: chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc

Issue 736793004: Repair/Enable TabCaptureApiTest.FullscreenEvents. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: REBASE Created 6 years, 1 month ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tab_capture/fullscreen_test.html » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
diff --git a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
index dcbfaf7c074b6b0ab4c2cb15b18c0f6bded2caf3..23be86cd9b02379ac7cbbbb67b6d05b26da14e07 100644
--- a/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
+++ b/chrome/browser/extensions/api/tab_capture/tab_capture_apitest.cc
@@ -10,7 +10,6 @@
#include "chrome/browser/extensions/extension_apitest.h"
#include "chrome/browser/extensions/tab_helper.h"
#include "chrome/browser/profiles/profile.h"
-#include "chrome/browser/ui/fullscreen/fullscreen_controller.h"
#include "chrome/browser/ui/tabs/tab_strip_model.h"
#include "chrome/browser/ui/tabs/tab_strip_model_observer.h"
#include "chrome/browser/ui/tabs/tab_utils.h"
@@ -18,6 +17,7 @@
#include "chrome/common/chrome_version_info.h"
#include "content/public/browser/render_frame_host.h"
#include "content/public/browser/render_process_host.h"
+#include "content/public/test/browser_test_utils.h"
#include "content/public/test/test_utils.h"
#include "extensions/browser/extension_registry.h"
#include "extensions/common/switches.h"
@@ -47,6 +47,14 @@ class TabCaptureApiTest : public ExtensionApiTest {
CommandLine::ForCurrentProcess()->AppendSwitchASCII(
switches::kWhitelistedExtensionID, kExtensionId);
}
+
+ protected:
+ void SimulateMouseClickInCurrentTab() {
+ content::SimulateMouseClick(
+ browser()->tab_strip_model()->GetActiveWebContents(),
+ 0,
+ blink::WebMouseEvent::ButtonLeft);
+ }
};
class TabCaptureApiPixelTest : public TabCaptureApiTest {
@@ -197,42 +205,34 @@ IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_ActiveTabPermission) {
// http://crbug.com/177163
#if defined(OS_WIN) && !defined(NDEBUG)
#define MAYBE_FullscreenEvents DISABLED_FullscreenEvents
-#elif defined(USE_AURA) || defined(OS_MACOSX)
-// These don't always fire fullscreen events when run in tests. Tested manually.
-#define MAYBE_FullscreenEvents DISABLED_FullscreenEvents
-#elif defined(OS_LINUX)
-// Flaky to get out of fullscreen in tests. Tested manually.
-#define MAYBE_FullscreenEvents DISABLED_FullscreenEvents
#else
#define MAYBE_FullscreenEvents FullscreenEvents
#endif
+// Tests that fullscreen transitions during a tab capture session dispatch
+// events to the onStatusChange listener. The test loads a page that toggles
+// fullscreen mode, using the Fullscreen Javascript API, in response to mouse
+// clicks.
IN_PROC_BROWSER_TEST_F(TabCaptureApiTest, MAYBE_FullscreenEvents) {
AddExtensionToCommandLineWhitelist();
- content::OpenURLParams params(GURL("chrome://version"),
- content::Referrer(),
- CURRENT_TAB,
- ui::PAGE_TRANSITION_LINK, false);
- content::WebContents* web_contents = browser()->OpenURL(params);
-
- ExtensionTestMessageListener listeners_setup("ready1", true);
- ExtensionTestMessageListener fullscreen_entered("ready2", true);
+ ExtensionTestMessageListener tab_capture_started("tab_capture_started", true);
+ ExtensionTestMessageListener entered_fullscreen("entered_fullscreen", true);
ASSERT_TRUE(RunExtensionSubtest("tab_capture", "fullscreen_test.html"))
<< message_;
- EXPECT_TRUE(listeners_setup.WaitUntilSatisfied());
+ EXPECT_TRUE(tab_capture_started.WaitUntilSatisfied());
+ tab_capture_started.Reply("");
- // Toggle fullscreen after setting up listeners.
- browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents,
- true);
- listeners_setup.Reply("");
+ // Click on the page to trigger the Javascript that will toggle the tab into
+ // fullscreen mode.
+ SimulateMouseClickInCurrentTab();
+ EXPECT_TRUE(entered_fullscreen.WaitUntilSatisfied());
+ entered_fullscreen.Reply("");
- // Toggle again after JS should have the event.
- EXPECT_TRUE(fullscreen_entered.WaitUntilSatisfied());
- browser()->fullscreen_controller()->ToggleFullscreenModeForTab(web_contents,
- false);
- fullscreen_entered.Reply("");
+ // Click again to exit fullscreen mode.
+ SimulateMouseClickInCurrentTab();
+ // Wait until the page examines its results and calls chrome.test.succeed().
ResultCatcher catcher;
catcher.RestrictToBrowserContext(browser()->profile());
EXPECT_TRUE(catcher.GetNextResult()) << catcher.message();
« no previous file with comments | « no previous file | chrome/test/data/extensions/api_test/tab_capture/fullscreen_test.html » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698