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

Side by Side Diff: chrome/browser/ui/views/find_bar_host_uitest.cc

Issue 10188003: Convert the last remaining find bar ui test to a browser test. Also convert all the find bar tests … (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: Fix on linux Created 8 years, 8 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/find_bar/find_bar_host_browsertest.cc ('k') | chrome/chrome_tests.gypi » ('j') | 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) 2012 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/app/chrome_command_ids.h"
6 #include "chrome/test/automation/automation_proxy.h"
7 #include "chrome/test/automation/browser_proxy.h"
8 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h"
10 #include "net/test/test_server.h"
11
12 class FindInPageControllerTest : public UITest {
13 public:
14 FindInPageControllerTest() {
15 show_window_ = true;
16 }
17 };
18
19 const std::string kSimplePage = "404_is_enough_for_us.html";
20
21 #if !defined(OS_WIN)
22 // Has never been enabled on other platforms http://crbug.com/45753
23 #define FindMovesOnTabClose_Issue1343052 \
24 DISABLED_FindMovesOnTabClose_Issue1343052
25 #endif
26 // The find window should not change its location just because we open and close
27 // a new tab.
28 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
29 net::TestServer test_server(net::TestServer::TYPE_HTTP,
30 net::TestServer::kLocalhost,
31 FilePath(FILE_PATH_LITERAL("chrome/test/data")));
32 ASSERT_TRUE(test_server.Start());
33
34 GURL url = test_server.GetURL(kSimplePage);
35 scoped_refptr<TabProxy> tabA(GetActiveTab());
36 ASSERT_TRUE(tabA.get());
37 ASSERT_TRUE(tabA->NavigateToURL(url));
38 WaitUntilTabCount(1);
39
40 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
41 ASSERT_TRUE(browser.get() != NULL);
42
43 // Toggle the bookmark bar state.
44 EXPECT_TRUE(browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR));
45 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true));
46
47 // Open the Find window and wait for it to animate.
48 EXPECT_TRUE(browser->OpenFindInPage());
49 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
50
51 // Find its location.
52 int x = -1, y = -1;
53 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y));
54
55 // Open another tab (tab B).
56 EXPECT_TRUE(browser->AppendTab(url));
57 scoped_refptr<TabProxy> tabB(GetActiveTab());
58 ASSERT_TRUE(tabB.get());
59
60 // Close tab B.
61 EXPECT_TRUE(tabB->Close(true));
62
63 // See if the Find window has moved.
64 int new_x = -1, new_y = -1;
65 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y));
66
67 EXPECT_EQ(x, new_x);
68 EXPECT_EQ(y, new_y);
69
70 // Now reset the bookmark bar state and try the same again.
71 EXPECT_TRUE(browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR));
72 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false));
73
74 // Bookmark bar has moved, reset our coordinates.
75 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y));
76
77 // Open another tab (tab C).
78 EXPECT_TRUE(browser->AppendTab(url));
79 scoped_refptr<TabProxy> tabC(GetActiveTab());
80 ASSERT_TRUE(tabC.get());
81
82 // Close it.
83 EXPECT_TRUE(tabC->Close(true));
84
85 // See if the Find window has moved.
86 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y));
87
88 EXPECT_EQ(x, new_x);
89 EXPECT_EQ(y, new_y);
90 }
OLDNEW
« no previous file with comments | « chrome/browser/ui/find_bar/find_bar_host_browsertest.cc ('k') | chrome/chrome_tests.gypi » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698