Index: chrome/test/data/webui/edit_search_engine_dialog_ui_test-inl.h |
diff --git a/chrome/test/data/webui/edit_search_engine_dialog_ui_test-inl.h b/chrome/test/data/webui/edit_search_engine_dialog_ui_test-inl.h |
new file mode 100644 |
index 0000000000000000000000000000000000000000..d3dbcb3391192b99865962781229348642d05c89 |
--- /dev/null |
+++ b/chrome/test/data/webui/edit_search_engine_dialog_ui_test-inl.h |
@@ -0,0 +1,68 @@ |
+// Copyright (c) 2011 The Chromium Authors. All rights reserved. |
+// Use of this source code is governed by a BSD-style license that can be |
+// found in the LICENSE file. |
+ |
+#include "base/stringprintf.h" |
+#include "base/utf_string_conversions.h" |
+#include "chrome/browser/search_engines/template_url.h" |
+#include "chrome/browser/ui/browser.h" |
+#include "chrome/browser/ui/webui/chrome_web_ui.h" |
+#include "chrome/browser/ui/webui/edit_search_engine_dialog_webui.h" |
+#include "chrome/browser/ui/webui/web_ui_browsertest.h" |
+#include "chrome/common/url_constants.h" |
+#include "chrome/test/base/test_html_dialog_observer.h" |
+#include "content/browser/renderer_host/render_view_host.h" |
+#include "content/browser/tab_contents/tab_contents.h" |
+#include "content/browser/webui/web_ui.h" |
+ |
+// Test framework for chrome/test/data/webui/edit_search_engine_dialog_test.js. |
+class EditSearchEngineDialogUITest : public WebUIBrowserTest { |
+ public: |
+ EditSearchEngineDialogUITest(); |
+ virtual ~EditSearchEngineDialogUITest(); |
+ |
+ private: |
+ virtual void SetUpOnMainThread() OVERRIDE; |
+}; |
+ |
+namespace { |
+// Creates a Template URL for testing purposes. |
+TemplateURL* CreateTestTemplateURL(int seed) { |
+ TemplateURL* turl = new TemplateURL(); |
+ turl->SetURL(base::StringPrintf("http://www.test%d.com/", seed), 0, 0); |
+ turl->set_keyword(ASCIIToUTF16(base::StringPrintf("keyword%d", seed))); |
+ turl->set_short_name(ASCIIToUTF16(base::StringPrintf("short%d", seed))); |
+ turl->set_safe_for_autoreplace(true); |
+ GURL favicon_url("http://favicon.url"); |
+ turl->SetFaviconURL(favicon_url); |
+ turl->set_date_created(base::Time::FromTimeT(100)); |
+ turl->set_last_modified(base::Time::FromTimeT(100)); |
+ turl->SetPrepopulateId(999999); |
+ turl->set_sync_guid(base::StringPrintf("0000-0000-0000-%04d", seed)); |
+ return turl; |
+} |
+} // namesapce |
+ |
+void EditSearchEngineDialogUITest::SetUpOnMainThread() { |
Sheridan Rawlins
2011/11/23 20:36:26
Can you have a look at http://codereview.chromium.
kevers
2011/11/24 20:03:25
See two options here: wait until 8586009 lands and
Sheridan Rawlins
2011/11/28 22:32:45
I'll back off on doing in this CL, if you just can
kevers
2011/11/29 17:36:37
Done.
kevers
2011/11/30 15:54:54
I see that http://codereview.chromium.org/8586009/
|
+ // Force the flag so that we will use the WebUI version of the Dialog. |
+ ChromeWebUI::OverrideMoreWebUI(true); |
+ |
+ // The TestHtmlDialogObserver will catch our dialog when it gets created. |
+ TestHtmlDialogObserver dialog_observer; |
+ |
+ // Show the Edit Search Engine Dialog. |
+ EditSearchEngineDialogWebUI::ShowEditSearchEngineDialog( |
+ CreateTestTemplateURL(0), |
+ browser()->profile()); |
+ |
+ // Now we can get the WebUI object from the observer, and make some details |
+ // about our test available to the JavaScript. |
+ WebUI* webui = dialog_observer.GetWebUI(); |
+ webui->tab_contents()->render_view_host()->SetWebUIProperty( |
+ "expectedUrl", chrome::kChromeUIEditSearchEngineDialogURL); |
+ |
+ // Tell the test which WebUI instance we are dealing with and complete |
+ // initialization of this test. |
+ SetWebUIInstance(webui); |
+ WebUIBrowserTest::SetUpOnMainThread(); |
+} |