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

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

Issue 8676008: Add automated test for the edit search engine dialog. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Fix typo. Created 9 years 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
(Empty)
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
3 // found in the LICENSE file.
4
5 #include "chrome/test/data/webui/edit_search_engine_dialog_browsertest.h"
6
7 #include "base/stringprintf.h"
8 #include "base/utf_string_conversions.h"
9 #include "chrome/browser/search_engines/template_url.h"
10 #include "chrome/browser/ui/browser.h"
11 #include "chrome/browser/ui/webui/chrome_web_ui.h"
12 #include "chrome/browser/ui/webui/edit_search_engine_dialog_webui.h"
13 #include "chrome/common/url_constants.h"
14 #include "chrome/test/base/test_html_dialog_observer.h"
15 #include "content/browser/renderer_host/render_view_host.h"
16 #include "content/browser/tab_contents/tab_contents.h"
17 #include "content/browser/webui/web_ui.h"
18
19 namespace {
James Hawkins 2011/12/01 17:07:34 Blank line after this.
kevers 2011/12/01 17:57:27 Done.
20 // Creates a Template URL for testing purposes.
21 TemplateURL* CreateTestTemplateURL(int seed) {
22 TemplateURL* turl = new TemplateURL();
23 turl->SetURL(base::StringPrintf("http://www.test%d.com/", seed), 0, 0);
24 turl->set_keyword(ASCIIToUTF16(base::StringPrintf("keyword%d", seed)));
25 turl->set_short_name(ASCIIToUTF16(base::StringPrintf("short%d", seed)));
26 turl->set_safe_for_autoreplace(true);
27 GURL favicon_url("http://favicon.url");
28 turl->SetFaviconURL(favicon_url);
29 turl->set_date_created(base::Time::FromTimeT(100));
30 turl->set_last_modified(base::Time::FromTimeT(100));
31 turl->SetPrepopulateId(999999);
32 turl->set_sync_guid(base::StringPrintf("0000-0000-0000-%04d", seed));
33 return turl;
34 }
35 } // namespace
James Hawkins 2011/12/01 17:07:34 Blank line before this.
kevers 2011/12/01 17:57:27 Done.
36
37 EditSearchEngineDialogUITest::EditSearchEngineDialogUITest() {}
38
39 EditSearchEngineDialogUITest::~EditSearchEngineDialogUITest() {}
40
41 void EditSearchEngineDialogUITest::ShowSearchEngineDialog() {
42 // Force the flag so that we will use the WebUI version of the Dialog.
43 ChromeWebUI::OverrideMoreWebUI(true);
44
45 // The TestHtmlDialogObserver will catch our dialog when it gets created.
46 TestHtmlDialogObserver dialog_observer(this);
47
48 // Show the Edit Search Engine Dialog.
49 EditSearchEngineDialogWebUI::ShowEditSearchEngineDialog(
50 CreateTestTemplateURL(0),
51 browser()->profile());
52
53 // Now we can get the WebUI object from the observer, and make some details
54 // about our test available to the JavaScript.
55 WebUI* webui = dialog_observer.GetWebUI();
56 webui->tab_contents()->render_view_host()->SetWebUIProperty(
57 "expectedUrl", chrome::kChromeUIEditSearchEngineDialogURL);
58
59 // Tell the test which WebUI instance we are dealing with and complete
60 // initialization of this test.
61 SetWebUIInstance(webui);
62 WebUIBrowserTest::SetUpOnMainThread();
63 }
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698