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

Side by Side Diff: chrome/browser/ui/webui/webui_webview_browsertest.cc

Issue 942533003: Enable <webview>.executeScript outside of Apps and Extensions [1] (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@decouple_brower_isolated_world_routingid_user_script_UserScriptSet_non_hostset_2
Patch Set: Add a test. Created 5 years, 9 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 2015 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 "base/macros.h"
6 #include "base/path_service.h"
7 #include "chrome/common/chrome_paths.h"
8 #include "chrome/common/url_constants.h"
9 #include "chrome/test/base/ui_test_utils.h"
10 #include "chrome/test/base/web_ui_browser_test.h"
11 #include "net/test/embedded_test_server/embedded_test_server.h"
12
13 class WebUIWebViewBrowserTest : public WebUIBrowserTest {
14 public:
15 WebUIWebViewBrowserTest() {}
16
17 void SetUpOnMainThread() override {
18 WebUIBrowserTest::SetUpOnMainThread();
19 AddLibrary(
20 base::FilePath(FILE_PATH_LITERAL("webview_execute_script_test.js")));
21
22 base::FilePath test_data_dir;
23 PathService::Get(chrome::DIR_TEST_DATA, &test_data_dir);
24 embedded_test_server()->ServeFilesFromDirectory(test_data_dir);
25 ASSERT_TRUE(embedded_test_server()->InitializeAndWaitUntilReady());
26 }
27
28 GURL GetTestUrl(const std::string& path) const {
29 return embedded_test_server()->base_url().Resolve(path);
30 }
31
32 GURL GetWebViewEnabledWebUIURL() const {
33 return GURL(chrome::kChromeUIChromeSigninURL);
34 }
35
36 private:
37 DISALLOW_COPY_AND_ASSIGN(WebUIWebViewBrowserTest);
38 };
39
40 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, ExecuteScriptCode) {
41 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL());
42
43 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest(
44 "testExecuteScriptCode",
45 new base::StringValue(GetTestUrl("empty.html").spec())));
46 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698