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

Side by Side Diff: chrome/browser/views/find_bar_win_uitest.cc

Issue 113722: Make automation proxy objects to ref_counted. That allows to process async no... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 7 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
OLDNEW
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2009 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 #include "chrome/app/chrome_dll_resource.h" 5 #include "chrome/app/chrome_dll_resource.h"
6 #include "chrome/test/automation/browser_proxy.h" 6 #include "chrome/test/automation/browser_proxy.h"
7 #include "chrome/test/automation/tab_proxy.h" 7 #include "chrome/test/automation/tab_proxy.h"
8 #include "chrome/test/ui/ui_test.h" 8 #include "chrome/test/ui/ui_test.h"
9 #include "net/url_request/url_request_unittest.h" 9 #include "net/url_request/url_request_unittest.h"
10 10
11 class FindInPageControllerTest : public UITest { 11 class FindInPageControllerTest : public UITest {
12 public: 12 public:
13 FindInPageControllerTest() { 13 FindInPageControllerTest() {
14 show_window_ = true; 14 show_window_ = true;
15 } 15 }
16 }; 16 };
17 17
18 const std::wstring kSimplePage = L"404_is_enough_for_us.html"; 18 const std::wstring kSimplePage = L"404_is_enough_for_us.html";
19 19
20 // The find window should not change its location just because we open and close 20 // The find window should not change its location just because we open and close
21 // a new tab. 21 // a new tab.
22 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) { 22 TEST_F(FindInPageControllerTest, FindMovesOnTabClose_Issue1343052) {
23 scoped_refptr<HTTPTestServer> server = 23 scoped_refptr<HTTPTestServer> server =
24 HTTPTestServer::CreateServer(L"chrome/test/data", NULL); 24 HTTPTestServer::CreateServer(L"chrome/test/data", NULL);
25 ASSERT_TRUE(NULL != server.get()); 25 ASSERT_TRUE(NULL != server.get());
26 26
27 GURL url = server->TestServerPageW(kSimplePage); 27 GURL url = server->TestServerPageW(kSimplePage);
28 scoped_ptr<TabProxy> tabA(GetActiveTab()); 28 scoped_refptr<TabProxy> tabA(GetActiveTab());
29 ASSERT_TRUE(tabA->NavigateToURL(url)); 29 ASSERT_TRUE(tabA->NavigateToURL(url));
30 WaitUntilTabCount(1); 30 WaitUntilTabCount(1);
31 31
32 scoped_ptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 32 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
33 ASSERT_TRUE(browser.get() != NULL); 33 ASSERT_TRUE(browser.get() != NULL);
34 34
35 // Toggle the bookmark bar state. 35 // Toggle the bookmark bar state.
36 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); 36 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR);
37 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true)); 37 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), true));
38 38
39 // Open the Find window and wait for it to animate. 39 // Open the Find window and wait for it to animate.
40 EXPECT_TRUE(browser->OpenFindInPage()); 40 EXPECT_TRUE(browser->OpenFindInPage());
41 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true)); 41 EXPECT_TRUE(WaitForFindWindowVisibilityChange(browser.get(), true));
42 42
43 // Find its location. 43 // Find its location.
44 int x = -1, y = -1; 44 int x = -1, y = -1;
45 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y)); 45 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y));
46 46
47 // Open another tab (tab B). 47 // Open another tab (tab B).
48 EXPECT_TRUE(browser->AppendTab(url)); 48 EXPECT_TRUE(browser->AppendTab(url));
49 scoped_ptr<TabProxy> tabB(GetActiveTab()); 49 scoped_refptr<TabProxy> tabB(GetActiveTab());
50 50
51 // Close tab B. 51 // Close tab B.
52 EXPECT_TRUE(tabB->Close(true)); 52 EXPECT_TRUE(tabB->Close(true));
53 53
54 // See if the Find window has moved. 54 // See if the Find window has moved.
55 int new_x = -1, new_y = -1; 55 int new_x = -1, new_y = -1;
56 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y)); 56 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y));
57 57
58 EXPECT_EQ(x, new_x); 58 EXPECT_EQ(x, new_x);
59 EXPECT_EQ(y, new_y); 59 EXPECT_EQ(y, new_y);
60 60
61 // Now reset the bookmark bar state and try the same again. 61 // Now reset the bookmark bar state and try the same again.
62 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR); 62 browser->ApplyAccelerator(IDC_SHOW_BOOKMARK_BAR);
63 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false)); 63 EXPECT_TRUE(WaitForBookmarkBarVisibilityChange(browser.get(), false));
64 64
65 // Bookmark bar has moved, reset our coordinates. 65 // Bookmark bar has moved, reset our coordinates.
66 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y)); 66 EXPECT_TRUE(browser->GetFindWindowLocation(&x, &y));
67 67
68 // Open another tab (tab C). 68 // Open another tab (tab C).
69 EXPECT_TRUE(browser->AppendTab(url)); 69 EXPECT_TRUE(browser->AppendTab(url));
70 scoped_ptr<TabProxy> tabC(GetActiveTab()); 70 scoped_refptr<TabProxy> tabC(GetActiveTab());
71 71
72 // Close it. 72 // Close it.
73 EXPECT_TRUE(tabC->Close(true)); 73 EXPECT_TRUE(tabC->Close(true));
74 74
75 // See if the Find window has moved. 75 // See if the Find window has moved.
76 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y)); 76 EXPECT_TRUE(browser->GetFindWindowLocation(&new_x, &new_y));
77 77
78 EXPECT_EQ(x, new_x); 78 EXPECT_EQ(x, new_x);
79 EXPECT_EQ(y, new_y); 79 EXPECT_EQ(y, new_y);
80 } 80 }
OLDNEW
« no previous file with comments | « chrome/browser/views/find_bar_win_interactive_uitest.cc ('k') | chrome/browser/views/tabs/tab_dragging_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698