Chromium Code Reviews| Index: ios/chrome/browser/ui/reading_list/reading_list_egtest.mm |
| diff --git a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm |
| index a5bffdb80322d5a7528286aebd2850454f0cbc44..b00bdf9e166a8f1bb25ad5b449a58d379780f210 100644 |
| --- a/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm |
| +++ b/ios/chrome/browser/ui/reading_list/reading_list_egtest.mm |
| @@ -67,6 +67,7 @@ const CFTimeInterval kDistillationTimeout = 5; |
| const CFTimeInterval kServerOperationDelay = 1; |
| const char kReadHeader[] = "Read"; |
| const char kUnreadHeader[] = "Unread"; |
| +GURL kDistillableFullURL; |
| // Overrides the NetworkChangeNotifier to enable distillation even if the device |
| // does not have network. |
| @@ -337,9 +338,7 @@ void AssertIsShowingDistillablePage(bool online) { |
| // Test Omnibox URL |
| [[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText( |
| - web::test::HttpServer::MakeUrl( |
| - kDistillableURL) |
| - .GetContent())] |
| + kDistillableFullURL.GetContent())] |
| assertWithMatcher:grey_notNil()]; |
| // Test presence of online page |
| @@ -375,6 +374,7 @@ void AssertIsShowingDistillablePage(bool online) { |
| - (void)setUp { |
| [super setUp]; |
| + kDistillableFullURL = web::test::HttpServer::MakeUrl(kDistillableURL); |
|
baxley
2017/06/06 18:14:16
Can we just replace kDistillableRullURL on line 34
huangml1
2017/06/07 18:10:54
Yes we can! Sorry that I mixed it up with previous
|
| ReadingListModel* model = GetReadingListModel(); |
| for (const GURL& url : model->Keys()) |
| model->RemoveEntryByURL(url); |
| @@ -450,8 +450,7 @@ void AssertIsShowingDistillablePage(bool online) { |
| // Tests that sharing a web page to the Reading List results in a snackbar |
| // appearing, and that the Reading List entry is present in the Reading List. |
| // Loads online version by tapping on entry. |
| -// TODO(crbug.com/724555): Re-enable the test. |
| -- (void)DISABLED_testSavingToReadingListAndLoadNormal { |
| +- (void)testSavingToReadingListAndLoadNormal { |
| auto network_change_disabler = |
| base::MakeUnique<net::NetworkChangeNotifier::DisableForTest>(); |
| auto wifi_network = base::MakeUnique<WifiNetworkChangeNotifier>(); |
| @@ -478,20 +477,20 @@ void AssertIsShowingDistillablePage(bool online) { |
| AssertIsShowingDistillablePage(true); |
| // Stop server to reload offline. |
| - server.Stop(); |
| + server.setSuspend(YES); |
| base::test::ios::SpinRunLoopWithMinDelay( |
| base::TimeDelta::FromSecondsD(kServerOperationDelay)); |
| chrome_test_util::GetCurrentWebState()->GetNavigationManager()->Reload( |
| web::ReloadType::NORMAL, false); |
| AssertIsShowingDistillablePage(false); |
| + server.setSuspend(NO); |
|
baxley
2017/06/06 18:14:17
What if the assert above fails? will the server be
huangml1
2017/06/07 18:10:54
You're right. I missed the condition. Now I stop
|
| } |
| // Tests that sharing a web page to the Reading List results in a snackbar |
| // appearing, and that the Reading List entry is present in the Reading List. |
| // Loads offline version by tapping on entry without web server. |
| -// TODO(crbug.com/724555): Re-enable the test. |
| -- (void)DISABLED_testSavingToReadingListAndLoadNoNetwork { |
| +- (void)testSavingToReadingListAndLoadNoNetwork { |
| auto network_change_disabler = |
| base::MakeUnique<net::NetworkChangeNotifier::DisableForTest>(); |
| auto wifi_network = base::MakeUnique<WifiNetworkChangeNotifier>(); |
| @@ -514,7 +513,7 @@ void AssertIsShowingDistillablePage(bool online) { |
| WaitForDistillation(); |
| // Stop server to generate error. |
| - server.Stop(); |
| + server.setSuspend(YES); |
| base::test::ios::SpinRunLoopWithMinDelay( |
| base::TimeDelta::FromSecondsD(kServerOperationDelay)); |
| // Long press the entry, and open it offline. |
| @@ -522,7 +521,7 @@ void AssertIsShowingDistillablePage(bool online) { |
| AssertIsShowingDistillablePage(false); |
| // Start server to reload online error. |
| - server.StartOrDie(); |
| + server.setSuspend(NO); |
|
baxley
2017/06/06 18:14:16
Same as last question, will this always get set pr
|
| base::test::ios::SpinRunLoopWithMinDelay( |
| base::TimeDelta::FromSecondsD(kServerOperationDelay)); |
| web::test::SetUpSimpleHttpServer(ResponsesForDistillationServer()); |