OLD | NEW |
(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 } |
OLD | NEW |