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

Side by Side Diff: chrome/test/automated_ui_tests/automated_ui_test_test.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/automated_ui_tests/automated_ui_test_base.h" 6 #include "chrome/test/automated_ui_tests/automated_ui_test_base.h"
7 #include "chrome/test/automation/browser_proxy.h" 7 #include "chrome/test/automation/browser_proxy.h"
8 #include "chrome/test/automation/tab_proxy.h" 8 #include "chrome/test/automation/tab_proxy.h"
9 #include "chrome/test/ui/ui_test.h" 9 #include "chrome/test/ui/ui_test.h"
10 #include "googleurl/src/gurl.h" 10 #include "googleurl/src/gurl.h"
(...skipping 86 matching lines...) Expand 10 before | Expand all | Expand 10 after
97 } 97 }
98 98
99 TEST_F(AutomatedUITestBase, OpenBrowserWindow) { 99 TEST_F(AutomatedUITestBase, OpenBrowserWindow) {
100 int num_browser_windows; 100 int num_browser_windows;
101 int tab_count; 101 int tab_count;
102 automation()->GetBrowserWindowCount(&num_browser_windows); 102 automation()->GetBrowserWindowCount(&num_browser_windows);
103 ASSERT_EQ(1, num_browser_windows); 103 ASSERT_EQ(1, num_browser_windows);
104 active_browser()->GetTabCount(&tab_count); 104 active_browser()->GetTabCount(&tab_count);
105 ASSERT_EQ(1, tab_count); 105 ASSERT_EQ(1, tab_count);
106 106
107 BrowserProxy* previous_browser; 107 scoped_refptr<BrowserProxy> browser_1;
108 ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&previous_browser)); 108 ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_1));
109 scoped_ptr<BrowserProxy>browser_1(previous_browser);
110 automation()->GetBrowserWindowCount(&num_browser_windows); 109 automation()->GetBrowserWindowCount(&num_browser_windows);
111 ASSERT_EQ(2, num_browser_windows); 110 ASSERT_EQ(2, num_browser_windows);
112 active_browser()->GetTabCount(&tab_count); 111 active_browser()->GetTabCount(&tab_count);
113 ASSERT_EQ(1, tab_count); 112 ASSERT_EQ(1, tab_count);
114 NewTab(); 113 NewTab();
115 browser_1->GetTabCount(&tab_count); 114 browser_1->GetTabCount(&tab_count);
116 ASSERT_EQ(1, tab_count); 115 ASSERT_EQ(1, tab_count);
117 active_browser()->GetTabCount(&tab_count); 116 active_browser()->GetTabCount(&tab_count);
118 ASSERT_EQ(2, tab_count); 117 ASSERT_EQ(2, tab_count);
119 118
120 ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&previous_browser)); 119 scoped_refptr<BrowserProxy> browser_2;
121 scoped_ptr<BrowserProxy>browser_2(previous_browser); 120 ASSERT_TRUE(OpenAndActivateNewBrowserWindow(&browser_2));
122 automation()->GetBrowserWindowCount(&num_browser_windows); 121 automation()->GetBrowserWindowCount(&num_browser_windows);
123 ASSERT_EQ(3, num_browser_windows); 122 ASSERT_EQ(3, num_browser_windows);
124 active_browser()->GetTabCount(&tab_count); 123 active_browser()->GetTabCount(&tab_count);
125 ASSERT_EQ(1, tab_count); 124 ASSERT_EQ(1, tab_count);
126 NewTab(); 125 NewTab();
127 NewTab(); 126 NewTab();
128 browser_1->GetTabCount(&tab_count); 127 browser_1->GetTabCount(&tab_count);
129 ASSERT_EQ(1, tab_count); 128 ASSERT_EQ(1, tab_count);
130 browser_2->GetTabCount(&tab_count); 129 browser_2->GetTabCount(&tab_count);
131 ASSERT_EQ(2, tab_count); 130 ASSERT_EQ(2, tab_count);
(...skipping 134 matching lines...) Expand 10 before | Expand all | Expand 10 after
266 ASSERT_TRUE(BackButton()); 265 ASSERT_TRUE(BackButton());
267 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 266 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
268 ASSERT_EQ(url1, url); 267 ASSERT_EQ(url1, url);
269 ASSERT_TRUE(ForwardButton()); 268 ASSERT_TRUE(ForwardButton());
270 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 269 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
271 ASSERT_EQ(url2, url); 270 ASSERT_EQ(url2, url);
272 ASSERT_TRUE(ReloadPage()); 271 ASSERT_TRUE(ReloadPage());
273 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url)); 272 ASSERT_TRUE(GetActiveTab()->GetCurrentURL(&url));
274 ASSERT_EQ(url2, url); 273 ASSERT_EQ(url2, url);
275 } 274 }
OLDNEW
« no previous file with comments | « chrome/test/automated_ui_tests/automated_ui_test_base.cc ('k') | chrome/test/automated_ui_tests/automated_ui_tests.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698