Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(89)

Side by Side Diff: ios/chrome/browser/ui/reading_list/reading_list_egtest.mm

Issue 2672393002: [ObjC ARC] Converts ios/chrome/browser/ui/reading_list:eg_tests to ARC. (Closed)
Patch Set: Created 3 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
« no previous file with comments | « ios/chrome/browser/ui/reading_list/BUILD.gn ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
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"
10 #include "base/strings/sys_string_conversions.h" 9 #include "base/strings/sys_string_conversions.h"
11 #include "components/reading_list/ios/reading_list_model.h" 10 #include "components/reading_list/ios/reading_list_model.h"
12 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h" 11 #include "ios/chrome/browser/reading_list/reading_list_model_factory.h"
13 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 12 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
14 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 13 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
15 #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"
16 #include "ios/chrome/grit/ios_strings.h" 15 #include "ios/chrome/grit/ios_strings.h"
17 #import "ios/chrome/test/app/chrome_test_util.h" 16 #import "ios/chrome/test/app/chrome_test_util.h"
18 #import "ios/chrome/test/earl_grey/accessibility_util.h" 17 #import "ios/chrome/test/earl_grey/accessibility_util.h"
19 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h" 18 #import "ios/chrome/test/earl_grey/chrome_earl_grey.h"
20 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h" 19 #import "ios/chrome/test/earl_grey/chrome_earl_grey_ui.h"
21 #import "ios/chrome/test/earl_grey/chrome_matchers.h" 20 #import "ios/chrome/test/earl_grey/chrome_matchers.h"
22 #import "ios/chrome/test/earl_grey/chrome_test_case.h" 21 #import "ios/chrome/test/earl_grey/chrome_test_case.h"
23 #import "ios/testing/wait_util.h" 22 #import "ios/testing/wait_util.h"
24 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h" 23 #import "ios/third_party/material_components_ios/src/components/Snackbar/src/Mat erialSnackbar.h"
25 #import "ios/web/public/test/http_server.h" 24 #import "ios/web/public/test/http_server.h"
26 #import "ios/web/public/test/http_server_util.h" 25 #import "ios/web/public/test/http_server_util.h"
27 26
27 #if !defined(__has_feature) || !__has_feature(objc_arc)
28 #error "This file requires ARC support."
29 #endif
30
28 namespace { 31 namespace {
29 const char kReadTitle[] = "foobar"; 32 const char kReadTitle[] = "foobar";
30 const char kReadURL[] = "http://readfoobar.com"; 33 const char kReadURL[] = "http://readfoobar.com";
31 const char kUnreadTitle[] = "I am an unread entry"; 34 const char kUnreadTitle[] = "I am an unread entry";
32 const char kUnreadURL[] = "http://unreadfoobar.com"; 35 const char kUnreadURL[] = "http://unreadfoobar.com";
33 const char kReadURL2[] = "http://kReadURL2.com"; 36 const char kReadURL2[] = "http://kReadURL2.com";
34 const char kReadTitle2[] = "read item 2"; 37 const char kReadTitle2[] = "read item 2";
35 const char kUnreadTitle2[] = "I am another unread entry"; 38 const char kUnreadTitle2[] = "I am another unread entry";
36 const char kUnreadURL2[] = "http://unreadfoobar2.com"; 39 const char kUnreadURL2[] = "http://unreadfoobar2.com";
37 const size_t kNumberReadEntries = 2; 40 const size_t kNumberReadEntries = 2;
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
126 // Asserts |header| is visible. 129 // Asserts |header| is visible.
127 void AssertHeaderNotVisible(std::string header) { 130 void AssertHeaderNotVisible(std::string header) {
128 [[EarlGrey selectElementWithMatcher:chrome_test_util:: 131 [[EarlGrey selectElementWithMatcher:chrome_test_util::
129 StaticTextWithAccessibilityLabel( 132 StaticTextWithAccessibilityLabel(
130 base::SysUTF8ToNSString(header))] 133 base::SysUTF8ToNSString(header))]
131 assertWithMatcher:grey_notVisible()]; 134 assertWithMatcher:grey_notVisible()];
132 } 135 }
133 136
134 // Opens the reading list menu using command line. 137 // Opens the reading list menu using command line.
135 void OpenReadingList() { 138 void OpenReadingList() {
136 base::scoped_nsobject<GenericChromeCommand> command( 139 GenericChromeCommand* command =
137 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_READING_LIST]); 140 [[GenericChromeCommand alloc] initWithTag:IDC_SHOW_READING_LIST];
138 chrome_test_util::RunCommandWithActiveViewController(command); 141 chrome_test_util::RunCommandWithActiveViewController(command);
139 } 142 }
140 143
141 // Adds a read and an unread entry to the model, opens the reading list menu and 144 // Adds a read and an unread entry to the model, opens the reading list menu and
142 // enter edit mode. 145 // enter edit mode.
143 void AddEntriesAndEnterEdit() { 146 void AddEntriesAndEnterEdit() {
144 ReadingListModel* model = GetReadingListModel(); 147 ReadingListModel* model = GetReadingListModel();
145 model->AddEntry(GURL(kReadURL), std::string(kReadTitle), 148 model->AddEntry(GURL(kReadURL), std::string(kReadTitle),
146 reading_list::ADDED_VIA_CURRENT_APP); 149 reading_list::ADDED_VIA_CURRENT_APP);
147 model->SetReadStatus(GURL(kReadURL), true); 150 model->SetReadStatus(GURL(kReadURL), true);
(...skipping 288 matching lines...) Expand 10 before | Expand all | Expand 10 after
436 // Tap the action sheet. 439 // Tap the action sheet.
437 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON); 440 TapButtonWithID(IDS_IOS_READING_LIST_MARK_READ_BUTTON);
438 441
439 AssertAllEntriesVisible(); 442 AssertAllEntriesVisible();
440 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel())); 443 XCTAssertEqual(kNumberReadEntries + 1, ModelReadSize(GetReadingListModel()));
441 XCTAssertEqual(kNumberUnreadEntries - 1, 444 XCTAssertEqual(kNumberUnreadEntries - 1,
442 GetReadingListModel()->unread_size()); 445 GetReadingListModel()->unread_size());
443 } 446 }
444 447
445 @end 448 @end
OLDNEW
« no previous file with comments | « ios/chrome/browser/ui/reading_list/BUILD.gn ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698