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

Side by Side Diff: chrome/test/base/web_ui_browsertest.h

Issue 12084029: Simplify how TestChromeWebUIControllerFactory is registered now that multiple WebUIControllerFactor… (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: sync to head Created 7 years, 10 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 | Annotate | Revision Log
OLDNEW
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2012 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 #ifndef CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ 5 #ifndef CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_
6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ 6 #define CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_
7 7
8 #include <string> 8 #include <string>
9 #include <vector> 9 #include <vector>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/memory/scoped_vector.h" 12 #include "base/memory/scoped_vector.h"
13 #include "base/string16.h" 13 #include "base/string16.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "content/public/test/js_injection_ready_observer.h" 15 #include "content/public/test/js_injection_ready_observer.h"
16 16
17 namespace base { 17 namespace base {
18 class Value; 18 class Value;
19 } 19 }
20 20
21 namespace content { 21 namespace content {
22 class RenderViewHost; 22 class RenderViewHost;
23 class WebUI; 23 class WebUI;
24 class WebUIMessageHandler; 24 class WebUIMessageHandler;
25 } 25 }
26 26
27 class TestChromeWebUIControllerFactory;
27 class WebUITestHandler; 28 class WebUITestHandler;
28 29
29 // This macro simplifies the declaration of simple javascript unit tests. 30 // This macro simplifies the declaration of simple javascript unit tests.
30 // Use: 31 // Use:
31 // WEB_UI_UNITTEST_F(MyWebUIPageTest, myJavascriptUnittest); 32 // WEB_UI_UNITTEST_F(MyWebUIPageTest, myJavascriptUnittest);
32 #define WEB_UI_UNITTEST_F(x, y) \ 33 #define WEB_UI_UNITTEST_F(x, y) \
33 IN_PROC_BROWSER_TEST_F(x, y) { \ 34 IN_PROC_BROWSER_TEST_F(x, y) { \
34 ASSERT_TRUE(RunJavascriptTest(#y)); \ 35 ASSERT_TRUE(RunJavascriptTest(#y)); \
35 } 36 }
36 37
(...skipping 84 matching lines...) Expand 10 before | Expand all | Expand 10 after
121 WebUIBrowserTest(); 122 WebUIBrowserTest();
122 123
123 // Accessors for preload test fixture and name. 124 // Accessors for preload test fixture and name.
124 void set_preload_test_fixture(const std::string& preload_test_fixture); 125 void set_preload_test_fixture(const std::string& preload_test_fixture);
125 void set_preload_test_name(const std::string& preload_test_name); 126 void set_preload_test_name(const std::string& preload_test_name);
126 127
127 // Set up & tear down console error catching. 128 // Set up & tear down console error catching.
128 virtual void SetUpOnMainThread() OVERRIDE; 129 virtual void SetUpOnMainThread() OVERRIDE;
129 virtual void CleanUpOnMainThread() OVERRIDE; 130 virtual void CleanUpOnMainThread() OVERRIDE;
130 131
131 // Set up test path & override for |kDummyURL|.
132 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
133
134 // Tear down override for |kDummyURL|.
135 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE;
136
137 // Set a WebUI instance to run tests on. 132 // Set a WebUI instance to run tests on.
138 void SetWebUIInstance(content::WebUI* web_ui); 133 void SetWebUIInstance(content::WebUI* web_ui);
139 134
140 // Returns a mock WebUI object under test (if any). 135 // Returns a mock WebUI object under test (if any).
141 virtual content::WebUIMessageHandler* GetMockMessageHandler(); 136 virtual content::WebUIMessageHandler* GetMockMessageHandler();
142 137
143 // Returns a file:// GURL constructed from |path| inside the test data dir for 138 // Returns a file:// GURL constructed from |path| inside the test data dir for
144 // webui tests. 139 // webui tests.
145 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); 140 static GURL WebUITestDataPathToURL(const FilePath::StringType& path);
146 141
(...skipping 44 matching lines...) Expand 10 before | Expand all | Expand 10 after
191 bool libraries_preloaded_; 186 bool libraries_preloaded_;
192 187
193 // Saves the states of |test_fixture| and |test_name| for calling 188 // Saves the states of |test_fixture| and |test_name| for calling
194 // PreloadJavascriptLibraries(). 189 // PreloadJavascriptLibraries().
195 std::string preload_test_fixture_; 190 std::string preload_test_fixture_;
196 std::string preload_test_name_; 191 std::string preload_test_name_;
197 192
198 // When this is non-NULL, this is The WebUI instance used for testing. 193 // When this is non-NULL, this is The WebUI instance used for testing.
199 // Otherwise the selected tab's web_ui is used. 194 // Otherwise the selected tab's web_ui is used.
200 content::WebUI* override_selected_web_ui_; 195 content::WebUI* override_selected_web_ui_;
196
197 scoped_ptr<TestChromeWebUIControllerFactory> test_factory_;
201 }; 198 };
202 199
203 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ 200 #endif // CHROME_TEST_BASE_WEB_UI_BROWSERTEST_H_
OLDNEW
« no previous file with comments | « chrome/test/base/test_chrome_web_ui_controller_factory_browsertest.cc ('k') | chrome/test/base/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698