Chromium Code Reviews| 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/mac/scoped_nsobject.h" | 9 #include "base/mac/scoped_nsobject.h" |
| 10 #include "base/strings/sys_string_conversions.h" | 10 #include "base/strings/sys_string_conversions.h" |
| 11 #include "components/reading_list/ios/reading_list_model.h" | 11 #include "components/reading_list/ios/reading_list_model.h" |
| 12 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" | 12 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" |
| 13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" | 13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" |
| 14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" | 14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" |
| 15 #import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.h" | 15 #import "ios/chrome/browser/ui/reading_list/reading_list_collection_view_item.h" |
| 16 #include "ios/chrome/grit/ios_strings.h" | 16 #include "ios/chrome/grit/ios_strings.h" |
| 17 #import "ios/chrome/test/app/chrome_test_util.h" | 17 #import "ios/chrome/test/app/chrome_test_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" |
| 22 #import "ios/testing/wait_util.h" | 23 #import "ios/testing/wait_util.h" |
| 23 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h" | 24 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h" |
| 24 #import "ios/web/public/test/http_server.h" | 25 #import "ios/web/public/test/http_server.h" |
| 25 #import "ios/web/public/test/http_server_util.h" | 26 #import "ios/web/public/test/http_server_util.h" |
| 26 | 27 |
| 27 namespace { | 28 namespace { |
| (...skipping 143 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 171 | 172 |
| 172 @implementation ReadingListTestCase | 173 @implementation ReadingListTestCase |
| 173 | 174 |
| 174 - (void)setUp { | 175 - (void)setUp { |
| 175 [super setUp]; | 176 [super setUp]; |
| 176 ReadingListModel* model = GetReadingListModel(); | 177 ReadingListModel* model = GetReadingListModel(); |
| 177 for (const GURL& url : model->Keys()) | 178 for (const GURL& url : model->Keys()) |
| 178 model->RemoveEntryByURL(url); | 179 model->RemoveEntryByURL(url); |
| 179 } | 180 } |
| 180 | 181 |
| 182 // Tests that the Reading List view is accessible. | |
| 183 - (void)testAccessibility { | |
| 184 AddEntriesAndEnterEdit(); | |
|
Olivier
2017/01/06 09:44:41
Should we test out of edit mode?
gambard
2017/01/06 09:51:53
Done.
| |
| 185 chrome_test_util::VerifyAccessibilityForCurrentScreen(); | |
| 186 } | |
| 187 | |
| 181 // Tests that sharing a web page to the Reading List results in a snackbar | 188 // Tests that sharing a web page to the Reading List results in a snackbar |
| 182 // appearing, and that the Reading List entry is present in the Reading List. | 189 // appearing, and that the Reading List entry is present in the Reading List. |
| 183 - (void)testSavingToReadingList { | 190 - (void)testSavingToReadingList { |
| 184 // Setup a server serving a page at http://potato with the title "tomato". | 191 // Setup a server serving a page at http://potato with the title "tomato". |
| 185 std::map<GURL, std::string> responses; | 192 std::map<GURL, std::string> responses; |
| 186 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://potato"); | 193 const GURL regularPageURL = web::test::HttpServer::MakeUrl("http://potato"); |
| 187 responses[regularPageURL] = "<html><head><title>tomato</title></head></html>"; | 194 responses[regularPageURL] = "<html><head><title>tomato</title></head></html>"; |
| 188 web::test::SetUpSimpleHttpServer(responses); | 195 web::test::SetUpSimpleHttpServer(responses); |
| 189 | 196 |
| 190 // Open http://potato | 197 // Open http://potato |
| (...skipping 230 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... | |
| 421 // Tap the action sheet. | 428 // Tap the action sheet. |
| 422 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON); | 429 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON); |
| 423 | 430 |
| 424 AssertAllEntriesVisible(); | 431 AssertAllEntriesVisible(); |
| 425 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel())); | 432 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel())); |
| 426 XCTAssertEqual(kNumberUnreadEntries - 1, | 433 XCTAssertEqual(kNumberUnreadEntries - 1, |
| 427 GetReadingListModel()->unread_size()); | 434 GetReadingListModel()->unread_size()); |
| 428 } | 435 } |
| 429 | 436 |
| 430 @end | 437 @end |
| OLD | NEW |