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/browser/download/download_uitest.cc

Issue 149281: Sprinkle some defensiveness into the UI tests so that they don't explode if t... (Closed) Base URL: svn://chrome-svn/chrome/trunk/src/
Patch Set: '' Created 11 years, 5 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/crash_recovery_uitest.cc ('k') | chrome/browser/download/save_page_uitest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2006-2008 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2006-2008 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 <sstream> 5 #include <sstream>
6 #include <string> 6 #include <string>
7 7
8 #include "build/build_config.h" 8 #include "build/build_config.h"
9 #if defined(OS_WIN) 9 #if defined(OS_WIN)
10 #include <shlwapi.h> 10 #include <shlwapi.h>
(...skipping 295 matching lines...) Expand 10 before | Expand all | Expand 10 after
306 L"100% - " + filename.ToWStringHack()); 306 L"100% - " + filename.ToWStringHack());
307 } 307 }
308 308
309 // Test that when downloading an item in Incognito mode, we don't crash when 309 // Test that when downloading an item in Incognito mode, we don't crash when
310 // closing the last Incognito window (http://crbug.com/13983). 310 // closing the last Incognito window (http://crbug.com/13983).
311 TEST_F(DownloadTest, MAYBE_IncognitoDownload) { 311 TEST_F(DownloadTest, MAYBE_IncognitoDownload) {
312 // Open a regular window and sanity check default values for window / tab 312 // Open a regular window and sanity check default values for window / tab
313 // count and shelf visibility. 313 // count and shelf visibility.
314 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0)); 314 scoped_refptr<BrowserProxy> browser(automation()->GetBrowserWindow(0));
315 int window_count = 0; 315 int window_count = 0;
316 automation()->GetBrowserWindowCount(&window_count); 316 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
317 ASSERT_EQ(1, window_count); 317 ASSERT_EQ(1, window_count);
318 EXPECT_EQ(1, GetTabCount()); 318 EXPECT_EQ(1, GetTabCount());
319 bool is_shelf_visible; 319 bool is_shelf_visible;
320 browser->IsShelfVisible(&is_shelf_visible); 320 browser->IsShelfVisible(&is_shelf_visible);
321 EXPECT_FALSE(is_shelf_visible); 321 EXPECT_FALSE(is_shelf_visible);
322 322
323 // Open an Incognito window. 323 // Open an Incognito window.
324 ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW)); 324 ASSERT_TRUE(browser->RunCommand(IDC_NEW_INCOGNITO_WINDOW));
325 scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1)); 325 scoped_refptr<BrowserProxy> incognito(automation()->GetBrowserWindow(1));
326 scoped_refptr<TabProxy> tab(incognito->GetTab(0)); 326 scoped_refptr<TabProxy> tab(incognito->GetTab(0));
327 automation()->GetBrowserWindowCount(&window_count); 327 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
328 ASSERT_EQ(2, window_count); 328 ASSERT_EQ(2, window_count);
329 329
330 // Download something. 330 // Download something.
331 FilePath file(FILE_PATH_LITERAL("download-test1.lib")); 331 FilePath file(FILE_PATH_LITERAL("download-test1.lib"));
332 //PlatformThread::Sleep(1000); 332 //PlatformThread::Sleep(1000);
333 ASSERT_TRUE(tab->NavigateToURL( 333 ASSERT_TRUE(tab->NavigateToURL(
334 URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack()))); 334 URLRequestMockHTTPJob::GetMockUrl(file.ToWStringHack())));
335 PlatformThread::Sleep(action_timeout_ms()); 335 PlatformThread::Sleep(action_timeout_ms());
336 336
337 // Verify that the download shelf is showing for the Incognito window. 337 // Verify that the download shelf is showing for the Incognito window.
338 EXPECT_TRUE(WaitForDownloadShelfVisible(incognito.get())); 338 EXPECT_TRUE(WaitForDownloadShelfVisible(incognito.get()));
339 339
340 // Close the Incognito window and don't crash. 340 // Close the Incognito window and don't crash.
341 ASSERT_TRUE(incognito->RunCommand(IDC_CLOSE_WINDOW)); 341 ASSERT_TRUE(incognito->RunCommand(IDC_CLOSE_WINDOW));
342 automation()->GetBrowserWindowCount(&window_count); 342 ASSERT_TRUE(automation()->GetBrowserWindowCount(&window_count));
343 ASSERT_EQ(1, window_count); 343 ASSERT_EQ(1, window_count);
344 344
345 // Verify that the regular window does not have a download shelf. 345 // Verify that the regular window does not have a download shelf.
346 browser->IsShelfVisible(&is_shelf_visible); 346 browser->IsShelfVisible(&is_shelf_visible);
347 EXPECT_FALSE(is_shelf_visible); 347 EXPECT_FALSE(is_shelf_visible);
348 348
349 CleanUpDownload(file); 349 CleanUpDownload(file);
350 } 350 }
351 351
352 } // namespace 352 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/crash_recovery_uitest.cc ('k') | chrome/browser/download/save_page_uitest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698