| 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 <UIKit/UIKit.h> | 6 #import <UIKit/UIKit.h> |
| 7 #import <XCTest/XCTest.h> | 7 #import <XCTest/XCTest.h> |
| 8 | 8 |
| 9 #include "base/strings/sys_string_conversions.h" | 9 #include "base/strings/sys_string_conversions.h" |
| 10 #include "components/reading_list/ios/reading_list_model.h" | 10 #include "components/reading_list/ios/reading_list_model.h" |
| 11 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 11 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 12 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 12 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 13 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 13 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 14 #import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.h" | 14 #import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.h" |
| 15 #include "ios/chrome/browser/ui/ui_util.h" |
| 15 #include "ios/chrome/grit/ios_strings.h" | 16 #include "ios/chrome/grit/ios_strings.h" |
| 16 #import "ios/chrome/test/app/chrome_test_util.h" | 17 #import "ios/chrome/test/app/chrome_test_util.h" |
| 17 #import "ios/chrome/test/earl_grey/accessibility_util.h" | 18 #import "ios/chrome/test/earl_grey/accessibility_util.h" |
| 18 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" | 19 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" |
| 19 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" | 20 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" |
| 20 #import "ios/chrome/test/earl_grey/chrome_matchers.h" | 21 #import "ios/chrome/test/earl_grey/chrome_matchers.h" |
| 21 #import "ios/chrome/test/earl_grey/chrome_test_case.h" | 22 #import "ios/chrome/test/earl_grey/chrome_test_case.h" |
| 23 #import "ios/testing/earl_grey/disabled_test_macros.h" |
| 22 #import "ios/testing/wait_util.h" | 24 #import "ios/testing/wait_util.h" |
| 23 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat
erialSnackbar.h" | 25 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat
erialSnackbar.h" |
| 24 #import "ios/web/public/test/http_server.h" | 26 #import "ios/web/public/test/http_server.h" |
| 25 #import "ios/web/public/test/http_server_util.h" | 27 #import "ios/web/public/test/http_server_util.h" |
| 26 | 28 |
| 27 #if !defined(__has_feature) || !__has_feature(objc_arc) | 29 #if !defined(__has_feature) || !__has_feature(objc_arc) |
| 28 #error "This file requires ARC support." | 30 #error "This file requires ARC support." |
| 29 #endif | 31 #endif |
| 30 | 32 |
| 31 namespace { | 33 namespace { |
| (...skipping 180 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 212 AddEntriesAndEnterEdit(); | 214 AddEntriesAndEnterEdit(); |
| 213 // In edit mode. | 215 // In edit mode. |
| 214 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 216 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 215 TapButtonWithID(IDS_IOS_READING_LIST_CANCEL_BUTTON); | 217 TapButtonWithID(IDS_IOS_READING_LIST_CANCEL_BUTTON); |
| 216 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | 218 chrome_test_util::VerifyAccessibilityForCurrentScreen(); |
| 217 } | 219 } |
| 218 | 220 |
| 219 // Tests that sharing a web page to the Reading List results in a snackbar | 221 // Tests that sharing a web page to the Reading List results in a snackbar |
| 220 // appearing, and that the Reading List entry is present in the Reading List. | 222 // appearing, and that the Reading List entry is present in the Reading List. |
| 221 - (void)testSavingToReadingList { | 223 - (void)testSavingToReadingList { |
| 224 // TODO(crbug.com/700001): This test is failing on iPad. |
| 225 if (IsIPadIdiom()) { |
| 226 EARL_GREY_TEST_DISABLED(@"Disabled for iPad"); |
| 227 } |
| 228 |
| 222 // Setup a server serving a page at http://potato with the title "tomato". | 229 // Setup a server serving a page at http://potato with the title "tomato". |
| 223 std::map<GURL, std::string> responses; | 230 std::map<GURL, std::string> responses; |
| 224 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://potato"); | 231 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://potato"); |
| 225 | 232 |
| 226 std::string contentToRemove = "Text that distillation should remove."; | 233 std::string contentToRemove = "Text that distillation should remove."; |
| 227 std::string contentToKeep = "Text that distillation should keep."; | 234 std::string contentToKeep = "Text that distillation should keep."; |
| 228 | 235 |
| 229 // Distillation only occurs on pages that are not too small. | 236 // Distillation only occurs on pages that are not too small. |
| 230 responses[regularPageURL] = "<html><head><title>tomato</title></head>" + | 237 responses[regularPageURL] = "<html><head><title>tomato</title></head>" + |
| 231 contentToRemove * 20 + "<article>" + | 238 contentToRemove * 20 + "<article>" + |
| (...skipping 256 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 488 // Tap the action sheet. | 495 // Tap the action sheet. |
| 489 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON); | 496 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON); |
| 490 | 497 |
| 491 AssertAllEntriesVisible(); | 498 AssertAllEntriesVisible(); |
| 492 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel())); | 499 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel())); |
| 493 XCTAssertEqual(kNumberUnreadEntries - 1, | 500 XCTAssertEqual(kNumberUnreadEntries - 1, |
| 494 GetReadingListModel()->unread_size()); | 501 GetReadingListModel()->unread_size()); |
| 495 } | 502 } |
| 496 | 503 |
| 497 @end | 504 @end |
| OLD | NEW |