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

Side by Side Diff: content/browser/renderer_host/resource_dispatcher_host_browsertest.cc

Issue 7080049: Tests for bug 5988. (Closed) Base URL: http://git.chromium.org/git/chromium.git@trunk
Patch Set: added browsertest insteaf of uitest. Created 9 years, 6 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/test/ui_test_utils.h ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "base/utf_string_conversions.h"
6 #include "chrome/browser/ui/browser.h"
7 #include "chrome/browser/ui/browser_list.h"
8 #include "chrome/test/in_process_browser_test.h"
9 #include "chrome/test/ui_test_utils.h"
10 #include "content/common/notification_type.h"
11 #include "content/browser/tab_contents/tab_contents.h"
12 #include "net/test/test_server.h"
13
14 class ResourceDispatcherHostBrowserTest : public InProcessBrowserTest {
15 public:
16 ResourceDispatcherHostBrowserTest() {
17 EnableDOMAutomation();
18 }
19
20 protected:
21 RenderViewHost* render_view_host() {
22 return browser()->GetSelectedTabContents()->render_view_host();
23 }
24 };
25
26 // Test title for content created by javascript window.open().
27 // See bug 5988
Paweł Hajdan Jr. 2011/06/04 09:33:55 nit: It's useful to put a URL instead of just a nu
28 IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle1) {
29 ASSERT_TRUE(test_server()->Start());
30
31 GURL url(test_server()->GetURL("files/dynamic1.html"));
32 ui_test_utils::NavigateToURL(browser(), url);
33
34 // Create dynamic popup.
35 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
36 render_view_host(), L"", L"OpenPopup();"));
37
38 std::set<Browser*> excluded;
39 excluded.insert(browser());
40 Browser* popup = ui_test_utils::WaitForBrowserNotInSet(excluded);
Paweł Hajdan Jr. 2011/06/04 09:33:55 Why not just WaitForNewBrowser? If that'd have a r
41
42 ASSERT_TRUE(popup);
43
44 string16 title = popup->GetWindowTitleForCurrentTab();
45 ASSERT_EQ(string16::size_type(0),
Paweł Hajdan Jr. 2011/06/04 09:33:55 nit: Please use << to make the actual title a part
46 title.find(ASCIIToUTF16("My Popup Title")));
47 }
48
49 // Test title for content created by javascript window.open().
50 // See bug 5988
51 IN_PROC_BROWSER_TEST_F(ResourceDispatcherHostBrowserTest, DynamicTitle2) {
52 ASSERT_TRUE(test_server()->Start());
53
54 GURL url(test_server()->GetURL("files/dynamic2.html"));
55 ui_test_utils::NavigateToURL(browser(), url);
56
57 // Create dynamic popup.
58 EXPECT_TRUE(ui_test_utils::ExecuteJavaScript(
59 render_view_host(), L"", L"OpenPopup();"));
60
61 std::set<Browser*> excluded;
62 excluded.insert(browser());
63 Browser* popup = ui_test_utils::WaitForBrowserNotInSet(excluded);
64
65 ASSERT_TRUE(popup);
66
67 string16 title = popup->GetWindowTitleForCurrentTab();
68 ASSERT_EQ(string16::size_type(0),
69 title.find(ASCIIToUTF16("My Dynamic Title")));
70 }
OLDNEW
« no previous file with comments | « chrome/test/ui_test_utils.h ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698