Commit 9e67f60f authored by Eugene But's avatar Eugene But Committed by Commit Bot

Add testSucessfullDownloadInIncognito EG test.

This test is the same as testSucessfullDownload, but downloads in
Incognito.

Also renamed DownloadManagerEGTest to DownloadManagerTestCase.

Bug: 854232
Cq-Include-Trybots: luci.chromium.try:ios-simulator-full-configs;master.tryserver.chromium.mac:ios-simulator-cronet
Change-Id: I873ec4ccad2911702a26b09028ef4e1478731bb2
Reviewed-on: https://chromium-review.googlesource.com/1108935
Commit-Queue: Sylvain Defresne <sdefresne@chromium.org>
Reviewed-by: default avatarSylvain Defresne <sdefresne@chromium.org>
Cr-Commit-Position: refs/heads/master@{#569189}
parent 8b9f5316
......@@ -6,6 +6,7 @@
#include "base/test/scoped_feature_list.h"
#include "ios/chrome/grit/ios_strings.h"
#import "ios/chrome/test/app/tab_test_util.h"
#import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
#import "ios/chrome/test/earl_grey/chrome_matchers.h"
#import "ios/chrome/test/earl_grey/chrome_test_case.h"
......@@ -52,12 +53,12 @@ std::unique_ptr<net::test_server::HttpResponse> GetResponse(
} // namespace
// Tests critical user journeys for Download Manager.
@interface DownloadManagerEGTest : ChromeTestCase {
@interface DownloadManagerTestCase : ChromeTestCase {
base::test::ScopedFeatureList _featureList;
}
@end
@implementation DownloadManagerEGTest
@implementation DownloadManagerTestCase
- (void)setUp {
[super setUp];
......@@ -92,6 +93,33 @@ std::unique_ptr<net::test_server::HttpResponse> GetResponse(
@"Open in... button did not show up");
}
// Tests sucessfull download up to the point where "Open in..." button is
// presented. EarlGreay does not allow testing "Open in..." dialog, because it
// is run in a separate process. Performs download in Incognito.
- (void)testSucessfullDownloadInIncognito {
chrome_test_util::OpenNewIncognitoTab();
[[GREYUIThreadExecutor sharedInstance] drainUntilIdle];
[ChromeEarlGrey loadURL:self.testServer->GetURL("/")];
[ChromeEarlGrey waitForWebViewContainingText:"Download"];
[ChromeEarlGrey tapWebViewElementWithID:@"download"];
[[EarlGrey selectElementWithMatcher:DownloadButton()]
performAction:grey_tap()];
// Wait until Open in... button is shown.
ConditionBlock openInShown = ^{
NSError* error = nil;
[[EarlGrey selectElementWithMatcher:OpenInButton()]
assertWithMatcher:grey_notNil()
error:&error];
return (error == nil);
};
GREYAssert(testing::WaitUntilConditionOrTimeout(
testing::kWaitForDownloadTimeout, openInShown),
@"Open in... button did not show up");
}
// Tests cancelling download UI.
- (void)testCancellingDownload {
[ChromeEarlGrey loadURL:self.testServer->GetURL("/")];
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment