| OLD | NEW |
| 1 // Copyright 2016 The Chromium Authors. All rights reserved. | 1 // Copyright 2016 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 #import <EarlGrey/EarlGrey.h> | 5 #import <EarlGrey/EarlGrey.h> |
| 6 #import <XCTest/XCTest.h> | 6 #import <XCTest/XCTest.h> |
| 7 | 7 |
| 8 #include "base/mac/bind_objc_block.h" | 8 #include "base/mac/bind_objc_block.h" |
| 9 #include "base/memory/ptr_util.h" | 9 #include "base/memory/ptr_util.h" |
| 10 #include "base/strings/stringprintf.h" | 10 #include "base/strings/stringprintf.h" |
| (...skipping 497 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 508 TabUsageRecorder::LOAD_SUCCESS, 1, | 508 TabUsageRecorder::LOAD_SUCCESS, 1, |
| 509 failureBlock); | 509 failureBlock); |
| 510 histogramTester.ExpectUniqueSample(kDidUserWaitForEvictedTabReload, | 510 histogramTester.ExpectUniqueSample(kDidUserWaitForEvictedTabReload, |
| 511 TabUsageRecorder::USER_WAITED, 1, | 511 TabUsageRecorder::USER_WAITED, 1, |
| 512 failureBlock); | 512 failureBlock); |
| 513 histogramTester.ExpectTotalCount(kEvictedTabReloadTime, 1, failureBlock); | 513 histogramTester.ExpectTotalCount(kEvictedTabReloadTime, 1, failureBlock); |
| 514 } | 514 } |
| 515 | 515 |
| 516 // Verify correct recording of metrics when the reloading of an evicted tab | 516 // Verify correct recording of metrics when the reloading of an evicted tab |
| 517 // fails. | 517 // fails. |
| 518 - (void)testEvictedTabReloadFailure { | 518 // TODO(crbug.com/684987): Re-enable this test. |
| 519 - (void)DISABLED_testEvictedTabReloadFailure { |
| 519 web::test::SetUpFileBasedHttpServer(); | 520 web::test::SetUpFileBasedHttpServer(); |
| 520 chrome_test_util::HistogramTester histogramTester; | 521 chrome_test_util::HistogramTester histogramTester; |
| 521 FailureBlock failureBlock = ^(NSString* error) { | 522 FailureBlock failureBlock = ^(NSString* error) { |
| 522 GREYFail(error); | 523 GREYFail(error); |
| 523 }; | 524 }; |
| 524 | 525 |
| 525 // This URL is purposely invalid so it triggers a navigation error. | 526 // This URL is purposely invalid so it triggers a navigation error. |
| 526 GURL invalidURL(kTestUrl1); | 527 GURL invalidURL(kTestUrl1); |
| 527 | 528 |
| 528 chrome_test_util::OpenNewTab(); | 529 chrome_test_util::OpenNewTab(); |
| (...skipping 429 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 958 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; | 959 [[GREYUIThreadExecutor sharedInstance] drainUntilIdle]; |
| 959 } | 960 } |
| 960 // The deleted tabs are purged during foregrounding and backgrounding. | 961 // The deleted tabs are purged during foregrounding and backgrounding. |
| 961 chrome_test_util::SimulateTabsBackgrounding(); | 962 chrome_test_util::SimulateTabsBackgrounding(); |
| 962 // Make sure |evicted_tabs_| purged the deleted tabs. | 963 // Make sure |evicted_tabs_| purged the deleted tabs. |
| 963 int evicted = chrome_test_util::GetEvictedMainTabCount(); | 964 int evicted = chrome_test_util::GetEvictedMainTabCount(); |
| 964 GREYAssertEqual(evicted, 0, @"Check number of evicted tabs"); | 965 GREYAssertEqual(evicted, 0, @"Check number of evicted tabs"); |
| 965 } | 966 } |
| 966 | 967 |
| 967 @end | 968 @end |
| OLD | NEW |