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

Side by Side Diff: content/browser/keyboard_lock/keyboard_lock_browsertest.cc

Issue 2805763004: [System-Keyboard-Lock] Forward navigator functions to RenderFrameHost (Closed)
Patch Set: Resolve review comments Created 3 years, 8 months 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 unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2017 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #include <stdint.h>
6
7 #include "base/command_line.h"
8 #include "base/files/file_path.h"
9 #include "base/location.h"
10 #include "base/memory/ref_counted.h"
11 #include "base/single_thread_task_runner.h"
12 #include "base/test/thread_test_helper.h"
13 #include "content/browser/web_contents/web_contents_impl.h"
14 #include "content/public/browser/browser_context.h"
15 #include "content/public/browser/browser_thread.h"
16 #include "content/public/browser/storage_partition.h"
17 #include "content/public/common/content_switches.h"
18 #include "content/public/test/browser_test_utils.h"
19 #include "content/public/test/content_browser_test.h"
20 #include "content/public/test/content_browser_test_utils.h"
21 #include "content/shell/browser/shell.h"
22
23 namespace content {
24
25 // This browser test is aimed towards exercising the File System API bindings
26 // and the actual implementation that lives in the browser side.
27 class KeyboardLockBrowserTest : public ContentBrowserTest {
28 public:
29 KeyboardLockBrowserTest() = default;
30
31 void SimpleTest(const GURL& test_url, const std::string& expected_result) {
32 // The test page will perform tests on keyboard lock APIs, then write the
33 // result into an element with id "result".
34 Shell* const the_browser = shell();
35
36 VLOG(0) << "Navigating to URL and blocking.";
37 ASSERT_TRUE(NavigateToURL(the_browser, test_url));
38 VLOG(0) << "Navigation done.";
39 std::string result;
40 ASSERT_TRUE(ExecuteScriptAndExtractString(
41 the_browser,
42 "window.domAutomationController.send("
43 "document.getElementById(\'result\').innerHTML);",
44 &result));
45 ASSERT_EQ(result, expected_result);
46 }
47 };
48
49 IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, RequestTest) {
50 // TODO: This test should receive "Succeeded" once the implementation in
whywhat 2017/04/11 14:52:33 nit: TODO(username) here and below
Hzj_jie 2017/04/12 02:51:05 Done.
51 // RenderFrameHostImpl has been finished.
52 SimpleTest(GetTestUrl("keyboard_lock", "request_keylock.html"),
53 "Failed: Unsupported");
54 }
55
56 IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, CancelTest) {
57 SimpleTest(GetTestUrl("keyboard_lock", "cancel_keylock.html"), "Succeeded");
58 }
59
60 IN_PROC_BROWSER_TEST_F(KeyboardLockBrowserTest, RequestTwiceTest) {
61 // TODO: This test should receive "Succeeded" once the implementation in
62 // RenderFrameHostImpl has been finished.
63 SimpleTest(GetTestUrl("keyboard_lock", "request_keylock_twice.html"),
64 "Failed: Last requestKeyLock() has not finished yet.\n"
65 "Failed: Unsupported\n");
66 }
67
68 } // namespace content
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698