OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 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 | 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/macros.h" | 5 #include "base/macros.h" |
6 #include "base/path_service.h" | 6 #include "base/path_service.h" |
7 #include "chrome/common/chrome_paths.h" | 7 #include "chrome/common/chrome_paths.h" |
8 #include "chrome/common/url_constants.h" | 8 #include "chrome/common/url_constants.h" |
9 #include "chrome/test/base/ui_test_utils.h" | 9 #include "chrome/test/base/ui_test_utils.h" |
10 #include "chrome/test/base/web_ui_browser_test.h" | 10 #include "chrome/test/base/web_ui_browser_test.h" |
(...skipping 34 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
45 new base::StringValue(GetTestUrl("empty.html").spec()))); | 45 new base::StringValue(GetTestUrl("empty.html").spec()))); |
46 } | 46 } |
47 | 47 |
48 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, ExecuteScriptCodeFromFile) { | 48 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, ExecuteScriptCodeFromFile) { |
49 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); | 49 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
50 | 50 |
51 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( | 51 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
52 "testExecuteScriptCodeFromFile", | 52 "testExecuteScriptCodeFromFile", |
53 new base::StringValue(GetTestUrl("empty.html").spec()))); | 53 new base::StringValue(GetTestUrl("empty.html").spec()))); |
54 } | 54 } |
| 55 |
| 56 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddContentScript) { |
| 57 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 58 |
| 59 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 60 "testAddContentScript", |
| 61 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 62 } |
| 63 |
| 64 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddMultiContentScripts) { |
| 65 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 66 |
| 67 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 68 "testAddMultiContentScripts", |
| 69 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 70 } |
| 71 |
| 72 IN_PROC_BROWSER_TEST_F( |
| 73 WebUIWebViewBrowserTest, |
| 74 AddContentScriptWithSameNameShouldOverwriteTheExistingOne) { |
| 75 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 76 |
| 77 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 78 "testAddContentScriptWithSameNameShouldOverwriteTheExistingOne", |
| 79 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 80 } |
| 81 |
| 82 IN_PROC_BROWSER_TEST_F( |
| 83 WebUIWebViewBrowserTest, |
| 84 AddContentScriptToOneWebViewShouldNotInjectToTheOtherWebView) { |
| 85 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 86 |
| 87 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 88 "testAddContentScriptToOneWebViewShouldNotInjectToTheOtherWebView", |
| 89 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 90 } |
| 91 |
| 92 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, AddAndRemoveContentScripts) { |
| 93 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 94 |
| 95 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 96 "testAddAndRemoveContentScripts", |
| 97 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 98 } |
| 99 |
| 100 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, |
| 101 AddContentScriptsWithNewWindowAPI) { |
| 102 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 103 |
| 104 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 105 "testAddContentScriptsWithNewWindowAPI", |
| 106 new base::StringValue(GetTestUrl("guest_from_opener.html").spec()))); |
| 107 } |
| 108 |
| 109 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, |
| 110 ContentScriptIsInjectedAfterTerminateAndReloadWebView) { |
| 111 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 112 |
| 113 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 114 "testContentScriptIsInjectedAfterTerminateAndReloadWebView", |
| 115 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 116 } |
| 117 |
| 118 IN_PROC_BROWSER_TEST_F(WebUIWebViewBrowserTest, |
| 119 ContentScriptExistsAsLongAsWebViewTagExists) { |
| 120 ui_test_utils::NavigateToURL(browser(), GetWebViewEnabledWebUIURL()); |
| 121 |
| 122 ASSERT_TRUE(WebUIBrowserTest::RunJavascriptAsyncTest( |
| 123 "testContentScriptExistsAsLongAsWebViewTagExists", |
| 124 new base::StringValue(GetTestUrl("empty.html").spec()))); |
| 125 } |
OLD | NEW |