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

Side by Side Diff: chrome/browser/ui/webui/web_ui_browsertest.h

Issue 8986007: Move WebUIMessageHandler to its own file in the public directory and put it in the content namesp... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 8 years, 11 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
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_
6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ 6 #define CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_
7 #pragma once 7 #pragma once
8 8
9 #include <string> 9 #include <string>
10 10
11 #include "base/file_path.h" 11 #include "base/file_path.h"
12 #include "base/string16.h" 12 #include "base/string16.h"
13 #include "chrome/browser/ui/webui/web_ui_test_handler.h" 13 #include "chrome/browser/ui/webui/web_ui_test_handler.h"
14 #include "chrome/test/base/in_process_browser_test.h" 14 #include "chrome/test/base/in_process_browser_test.h"
15 #include "content/test/js_injection_ready_observer.h" 15 #include "content/test/js_injection_ready_observer.h"
16 #include "content/test/test_navigation_observer.h" 16 #include "content/test/test_navigation_observer.h"
17 17
18 class RenderViewHost; 18 class RenderViewHost;
19 class WebUIMessageHandler;
20 19
21 namespace base { 20 namespace base {
22 class Value; 21 class Value;
23 } 22 }
24 23
24 namespace content {
25 class WebUIMessageHandler;
26 }
27
25 // This macro simplifies the declaration of simple javascript unit tests. 28 // This macro simplifies the declaration of simple javascript unit tests.
26 // Use: 29 // Use:
27 // WEB_UI_UNITTEST_F(MyWebUIPageTest, myJavascriptUnittest); 30 // WEB_UI_UNITTEST_F(MyWebUIPageTest, myJavascriptUnittest);
28 #define WEB_UI_UNITTEST_F(x, y) \ 31 #define WEB_UI_UNITTEST_F(x, y) \
29 IN_PROC_BROWSER_TEST_F(x, y) { \ 32 IN_PROC_BROWSER_TEST_F(x, y) { \
30 ASSERT_TRUE(RunJavascriptTest(#y)); \ 33 ASSERT_TRUE(RunJavascriptTest(#y)); \
31 } 34 }
32 35
33 // The runner of WebUI javascript based tests. 36 // The runner of WebUI javascript based tests.
34 // See chrome/test/data/webui/test_api.js for the javascript side test API's. 37 // See chrome/test/data/webui/test_api.js for the javascript side test API's.
(...skipping 92 matching lines...) Expand 10 before | Expand all | Expand 10 after
127 // Set up test path & override for |kDummyURL|. 130 // Set up test path & override for |kDummyURL|.
128 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE; 131 virtual void SetUpInProcessBrowserTestFixture() OVERRIDE;
129 132
130 // Tear down override for |kDummyURL|. 133 // Tear down override for |kDummyURL|.
131 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE; 134 virtual void TearDownInProcessBrowserTestFixture() OVERRIDE;
132 135
133 // Set a WebUI instance to run tests on. 136 // Set a WebUI instance to run tests on.
134 void SetWebUIInstance(WebUI* web_ui); 137 void SetWebUIInstance(WebUI* web_ui);
135 138
136 // Returns a mock WebUI object under test (if any). 139 // Returns a mock WebUI object under test (if any).
137 virtual WebUIMessageHandler* GetMockMessageHandler(); 140 virtual content::WebUIMessageHandler* GetMockMessageHandler();
138 141
139 // Returns a file:// GURL constructed from |path| inside the test data dir for 142 // Returns a file:// GURL constructed from |path| inside the test data dir for
140 // webui tests. 143 // webui tests.
141 static GURL WebUITestDataPathToURL(const FilePath::StringType& path); 144 static GURL WebUITestDataPathToURL(const FilePath::StringType& path);
142 145
143 private: 146 private:
144 // JsInjectionReadyObserver implementation. 147 // JsInjectionReadyObserver implementation.
145 virtual void OnJsInjectionReady(RenderViewHost* render_view_host) OVERRIDE; 148 virtual void OnJsInjectionReady(RenderViewHost* render_view_host) OVERRIDE;
146 149
147 // Builds a string containing all added javascript libraries. 150 // Builds a string containing all added javascript libraries.
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after
189 // PreloadJavascriptLibraries(). 192 // PreloadJavascriptLibraries().
190 std::string preload_test_fixture_; 193 std::string preload_test_fixture_;
191 std::string preload_test_name_; 194 std::string preload_test_name_;
192 195
193 // When this is non-NULL, this is The WebUI instance used for testing. 196 // When this is non-NULL, this is The WebUI instance used for testing.
194 // Otherwise the selected tab's web_ui is used. 197 // Otherwise the selected tab's web_ui is used.
195 WebUI* override_selected_web_ui_; 198 WebUI* override_selected_web_ui_;
196 }; 199 };
197 200
198 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_ 201 #endif // CHROME_BROWSER_UI_WEBUI_WEB_UI_BROWSERTEST_H_
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/tracing_ui.cc ('k') | chrome/browser/ui/webui/web_ui_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698