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

Side by Side Diff: chrome/test/data/webui/webui_resource_browsertest.cc

Issue 683813004: Fewer focusable items in chrome://settings/searchEngines (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Load test-only resources from browser_tests.pak Created 6 years, 1 month 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
1 // Copyright 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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 <vector> 5 #include <vector>
6 6
7 #include "base/path_service.h"
7 #include "chrome/browser/ui/browser.h" 8 #include "chrome/browser/ui/browser.h"
8 #include "chrome/browser/ui/tabs/tab_strip_model.h" 9 #include "chrome/browser/ui/tabs/tab_strip_model.h"
10 #include "chrome/grit/options_test_resources.h"
9 #include "chrome/test/base/in_process_browser_test.h" 11 #include "chrome/test/base/in_process_browser_test.h"
10 #include "chrome/test/base/ui_test_utils.h" 12 #include "chrome/test/base/ui_test_utils.h"
11 #include "content/public/browser/notification_registrar.h" 13 #include "content/public/browser/notification_registrar.h"
12 #include "content/public/browser/web_contents.h" 14 #include "content/public/browser/web_contents.h"
13 #include "content/public/test/browser_test_utils.h" 15 #include "content/public/test/browser_test_utils.h"
16 #include "ui/base/resource/resource_bundle.h"
14 #include "ui/resources/grit/webui_resources.h" 17 #include "ui/resources/grit/webui_resources.h"
15 18
16 class WebUIResourceBrowserTest : public InProcessBrowserTest { 19 class WebUIResourceBrowserTest : public InProcessBrowserTest {
17 public: 20 public:
21 void SetUpOnMainThread() override {
22 // Load resources that are only used by browser_tests.
23 base::FilePath pak_path;
24 ASSERT_TRUE(PathService::Get(base::DIR_MODULE, &pak_path));
25 pak_path = pak_path.AppendASCII("browser_tests.pak");
26 ResourceBundle::GetSharedInstance().AddDataPackFromPath(
bondd 2014/11/07 17:36:14 I don't see any way to check whether AddDataPackFr
27 pak_path, ui::SCALE_FACTOR_NONE);
28 }
29
18 // Runs all test functions in |file|, waiting for them to complete. 30 // Runs all test functions in |file|, waiting for them to complete.
19 void RunTest(const base::FilePath& file) { 31 void RunTest(const base::FilePath& file) {
20 GURL url = ui_test_utils::GetTestUrl( 32 GURL url = ui_test_utils::GetTestUrl(
21 base::FilePath(FILE_PATH_LITERAL("webui")), file); 33 base::FilePath(FILE_PATH_LITERAL("webui")), file);
22 ui_test_utils::NavigateToURL(browser(), url); 34 ui_test_utils::NavigateToURL(browser(), url);
23 35
24 content::WebContents* web_contents = 36 content::WebContents* web_contents =
25 browser()->tab_strip_model()->GetActiveWebContents(); 37 browser()->tab_strip_model()->GetActiveWebContents();
26 ASSERT_TRUE(web_contents); 38 ASSERT_TRUE(web_contents);
27 EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_)); 39 EXPECT_TRUE(ExecuteWebUIResourceTest(web_contents, include_libraries_));
(...skipping 71 matching lines...) Expand 10 before | Expand all | Expand 10 after
99 } 111 }
100 112
101 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSingleSelectionModelTest) { 113 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, ListSingleSelectionModelTest) {
102 AddLibrary(IDR_WEBUI_JS_CR); 114 AddLibrary(IDR_WEBUI_JS_CR);
103 AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET); 115 AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
104 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SINGLE_SELECTION_MODEL); 116 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SINGLE_SELECTION_MODEL);
105 RunTest(base::FilePath(FILE_PATH_LITERAL( 117 RunTest(base::FilePath(FILE_PATH_LITERAL(
106 "list_single_selection_model_test.html"))); 118 "list_single_selection_model_test.html")));
107 } 119 }
108 120
121 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, InlineEditableListTest) {
122 AddLibrary(IDR_WEBUI_JS_CR);
123 AddLibrary(IDR_WEBUI_JS_CR_EVENT_TARGET);
124 AddLibrary(IDR_WEBUI_JS_CR_UI);
125 AddLibrary(IDR_WEBUI_JS_CR_UI_ARRAY_DATA_MODEL);
126 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_ITEM);
127 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_CONTROLLER);
128 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST_SELECTION_MODEL);
129 AddLibrary(IDR_WEBUI_JS_CR_UI_LIST);
130 AddLibrary(IDR_WEBUI_JS_LOAD_TIME_DATA);
131 AddLibrary(IDR_OPTIONS_DELETABLE_ITEM_LIST);
132 AddLibrary(IDR_OPTIONS_INLINE_EDITABLE_LIST);
133 RunTest(base::FilePath(FILE_PATH_LITERAL(
134 "inline_editable_list_test.html")));
135 }
136
109 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MenuTest) { 137 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, MenuTest) {
110 AddLibrary(IDR_WEBUI_JS_ASSERT); 138 AddLibrary(IDR_WEBUI_JS_ASSERT);
111 AddLibrary(IDR_WEBUI_JS_CR); 139 AddLibrary(IDR_WEBUI_JS_CR);
112 AddLibrary(IDR_WEBUI_JS_CR_UI); 140 AddLibrary(IDR_WEBUI_JS_CR_UI);
113 AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND); 141 AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND);
114 AddLibrary(IDR_WEBUI_JS_CR_UI_MENU_ITEM); 142 AddLibrary(IDR_WEBUI_JS_CR_UI_MENU_ITEM);
115 AddLibrary(IDR_WEBUI_JS_CR_UI_MENU); 143 AddLibrary(IDR_WEBUI_JS_CR_UI_MENU);
116 RunTest(base::FilePath(FILE_PATH_LITERAL("menu_test.html"))); 144 RunTest(base::FilePath(FILE_PATH_LITERAL("menu_test.html")));
117 } 145 }
118 146
(...skipping 19 matching lines...) Expand all
138 RunTest(base::FilePath(FILE_PATH_LITERAL("repeating_button_test.html"))); 166 RunTest(base::FilePath(FILE_PATH_LITERAL("repeating_button_test.html")));
139 } 167 }
140 168
141 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, CommandTest) { 169 IN_PROC_BROWSER_TEST_F(WebUIResourceBrowserTest, CommandTest) {
142 AddLibrary(IDR_WEBUI_JS_ASSERT); 170 AddLibrary(IDR_WEBUI_JS_ASSERT);
143 AddLibrary(IDR_WEBUI_JS_CR); 171 AddLibrary(IDR_WEBUI_JS_CR);
144 AddLibrary(IDR_WEBUI_JS_CR_UI); 172 AddLibrary(IDR_WEBUI_JS_CR_UI);
145 AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND); 173 AddLibrary(IDR_WEBUI_JS_CR_UI_COMMAND);
146 RunTest(base::FilePath(FILE_PATH_LITERAL("command_test.html"))); 174 RunTest(base::FilePath(FILE_PATH_LITERAL("command_test.html")));
147 } 175 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698