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

Unified Diff: chrome/test/data/webui/webui_resource_browsertest.cc

Issue 1246253002: Convert i18n_process.css to use /deep/ instead of ::shadow and add tests. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: thestig@ review Created 5 years, 5 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 side-by-side diff with in-line comments
Download patch
« no previous file with comments | « chrome/test/data/webui/i18n_process_css_test.html ('k') | chrome/test/data/webui_test_resources.grd » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: chrome/test/data/webui/webui_resource_browsertest.cc
diff --git a/chrome/test/data/webui/webui_resource_browsertest.cc b/chrome/test/data/webui/webui_resource_browsertest.cc
index a1384a75f570471987f287dafd58454403be9080..3f376b427a203efa3921e07a9ed8fc0da55bad7d 100644
--- a/chrome/test/data/webui/webui_resource_browsertest.cc
+++ b/chrome/test/data/webui/webui_resource_browsertest.cc
@@ -10,6 +10,7 @@
#include "chrome/grit/options_test_resources.h"
#include "chrome/test/base/in_process_browser_test.h"
#include "chrome/test/base/ui_test_utils.h"
+#include "chrome/test/data/grit/webui_test_resources.h"
#include "content/public/browser/notification_registrar.h"
#include "content/public/browser/web_contents.h"
#include "content/public/test/browser_test_utils.h"
@@ -28,15 +29,15 @@ class WebUIResourceBrowserTest : public InProcessBrowserTest {
}
// Runs all test functions in |file|, waiting for them to complete.
- void RunTest(const base::FilePath& file) {
- GURL url = ui_test_utils::GetTestUrl(
- base::FilePath(FILE_PATH_LITERAL("webui")), file);
- ui_test_utils::NavigateToURL(browser(), url);
+ void LoadFile(const base::FilePath& file) {
+ base::FilePath webui(FILE_PATH_LITERAL("webui"));
+ RunTest(ui_test_utils::GetTestUrl(webui, file));
+ }
- content::WebContents* web_contents =
- browser()->tab_strip_model()->GetActiveWebContents();
- ASSERT_TRUE(web_contents);
- EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_));
+ void LoadResource(int idr) {
+ ResourceBundle& bundle = ResourceBundle::GetSharedInstance();
+ base::StringPiece resource = bundle.GetRawDataResource(idr);
+ RunTest(GURL(std::string("data:text/html,") + resource.as_string()));
}
// Queues the library corresponding to |resource_id| for injection into the
@@ -48,6 +49,14 @@ class WebUIResourceBrowserTest : public InProcessBrowserTest {
}
private:
+ void RunTest(const GURL& url) {
+ ui_test_utils::NavigateToURL(browser(), url);
+ content::WebContents* web_contents =
+ browser()->tab_strip_model()->GetActiveWebContents();
+ ASSERT_TRUE(web_contents);
+ EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_));
+ }
+
// Resource IDs for internal javascript libraries to inject into the test.
std::vector<int> include_libraries_;
};
@@ -56,26 +65,30 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ArrayDataModelTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
AddLibrary(IDR_WEBUI_JS_CR_UI_ARRAY_DATA_MODEL);
- RunTest(base::FilePath(FILE_PATH_LITERAL("array_data_model_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("array_data_model_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, CrTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
- RunTest(base::FilePath(FILE_PATH_LITERAL("cr_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("cr_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, EventTargetTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
- RunTest(base::FilePath(FILE_PATH_LITERAL("event_target_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("event_target_test.html")));
+}
+
+IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, I18nProcessCssTest) {
+ LoadResource(IDR_WEBUI_TEST_I18N_PROCESS_CSS_TEST);
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, I18nProcessTest) {
AddLibrary(IDR_WEBUI_JS_LOAD_TIME_DATA);
AddLibrary(IDR_WEBUI_JS_I18N_TEMPLATE_NO_PROCESS);
AddLibrary(IDR_WEBUI_JS_UTIL);
- RunTest(base::FilePath(FILE_PATH_LITERAL("i18n_process_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("i18n_process_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListTest) {
@@ -87,7 +100,7 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListTest) {
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_CONTROLLER);
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL);
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST);
- RunTest(base::FilePath(FILE_PATH_LITERAL("list_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("list_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, GridTest) {
@@ -101,27 +114,27 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, GridTest) {
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL);
// Grid must be the last addition as it depends on list libraries.
AddLibrary(IDR_WEBUI_JS_CR_UI_GRID);
- RunTest(base::FilePath(FILE_PATH_LITERAL("grid_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("grid_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, LinkControllerTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_LINK_CONTROLLER);
- RunTest(base::FilePath(FILE_PATH_LITERAL("link_controller_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("link_controller_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSelectionModelTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL);
- RunTest(base::FilePath(FILE_PATH_LITERAL("list_selection_model_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("list_selection_model_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSingleSelectionModelTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SINGLE_SELECTION_MODEL);
- RunTest(base::FilePath(FILE_PATH_LITERAL(
+ LoadFile(base::FilePath(FILE_PATH_LITERAL(
"list_single_selection_model_test.html")));
}
@@ -137,7 +150,7 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, InlineEditableListTest) {
AddLibrary(IDR_WEBUI_JS_LOAD_TIME_DATA);
AddLibrary(IDR_OPTIONS_DELETABLE_ITEM_LIST);
AddLibrary(IDR_OPTIONS_INLINE_EDITABLE_LIST);
- RunTest(base::FilePath(FILE_PATH_LITERAL(
+ LoadFile(base::FilePath(FILE_PATH_LITERAL(
"inline_editable_list_test.html")));
}
@@ -148,29 +161,29 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MenuTest) {
AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND);
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU_ITEM);
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU);
- RunTest(base::FilePath(FILE_PATH_LITERAL("menu_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("menu_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MockTimerTest) {
- RunTest(base::FilePath(FILE_PATH_LITERAL("mock_timer_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("mock_timer_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ParseHtmlSubsetTest) {
AddLibrary(IDR_WEBUI_JS_PARSE_HTML_SUBSET);
- RunTest(base::FilePath(FILE_PATH_LITERAL("parse_html_subset_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("parse_html_subset_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, PositionUtilTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_UI_POSITION_UTIL);
- RunTest(base::FilePath(FILE_PATH_LITERAL("position_util_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("position_util_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, RepeatingButtonTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_UI);
AddLibrary(IDR_WEBUI_JS_CR_UI_REPEATING_BUTTON);
- RunTest(base::FilePath(FILE_PATH_LITERAL("repeating_button_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("repeating_button_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, CommandTest) {
@@ -178,7 +191,7 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, CommandTest) {
AddLibrary(IDR_WEBUI_JS_CR);
AddLibrary(IDR_WEBUI_JS_CR_UI);
AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND);
- RunTest(base::FilePath(FILE_PATH_LITERAL("command_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("command_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ContextMenuHandlerTest) {
@@ -192,7 +205,7 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ContextMenuHandlerTest) {
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU_BUTTON);
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU);
AddLibrary(IDR_WEBUI_JS_CR_UI_CONTEXT_MENU_HANDLER);
- RunTest(base::FilePath(FILE_PATH_LITERAL("context_menu_handler_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("context_menu_handler_test.html")));
}
IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MenuButtonTest) {
@@ -203,5 +216,5 @@ IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MenuButtonTest) {
AddLibrary(IDR_WEBUI_JS_CR_UI_POSITION_UTIL);
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU_BUTTON);
AddLibrary(IDR_WEBUI_JS_CR_UI_MENU);
- RunTest(base::FilePath(FILE_PATH_LITERAL("menu_button_test.html")));
+ LoadFile(base::FilePath(FILE_PATH_LITERAL("menu_button_test.html")));
}
« no previous file with comments | « chrome/test/data/webui/i18n_process_css_test.html ('k') | chrome/test/data/webui_test_resources.grd » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698