Commit 0883bb08 authored by Peter Kasting's avatar Peter Kasting Committed by Commit Bot

Remove using directives ("using namespace x") from ios/.

Bug: 82078
Change-Id: I471bc6109877cebbbbdb2467ceb0197b9d2906ac
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/1824647Reviewed-by: default avatarMark Cogan <marq@chromium.org>
Commit-Queue: Peter Kasting <pkasting@chromium.org>
Auto-Submit: Peter Kasting <pkasting@chromium.org>
Cr-Commit-Position: refs/heads/master@{#701457}
parent 70586989
......@@ -47,7 +47,14 @@
#error "This file requires ARC support."
#endif
using namespace ntp_snippets;
using ntp_snippets::AdditionalSuggestionsHelper;
using ntp_snippets::Category;
using ntp_snippets::CategoryStatus;
using ntp_snippets::ContentSuggestion;
using ntp_snippets::ContentSuggestionsService;
using ntp_snippets::CreateChromeContentSuggestionsService;
using ntp_snippets::KnownCategories;
using ntp_snippets::MockContentSuggestionsProvider;
using testing::_;
using testing::Invoke;
using testing::WithArg;
......@@ -198,11 +205,11 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) {
// Add 3 suggestions, persisted accross page loads.
std::vector<ContentSuggestion> suggestions;
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium1", GURL("http://chromium.org/1")));
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium2", GURL("http://chromium.org/2")));
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium3", GURL("http://chromium.org/3")));
self.provider->FireSuggestionsChanged(self.category, std::move(suggestions));
......@@ -238,15 +245,15 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) {
- (void)testReloadPage {
// Add 2 suggestions.
std::vector<ContentSuggestion> suggestions;
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium1", GURL("http://chromium.org/1")));
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium2", GURL("http://chromium.org/2")));
self.provider->FireSuggestionsChanged(self.category, std::move(suggestions));
// Change the suggestions to have one the second one.
std::vector<ContentSuggestion> suggestionsOnly;
suggestionsOnly.emplace_back(
suggestionsOnly.push_back(
Suggestion(self.category, "chromium2", GURL("http://chromium.org/2")));
self.provider->FireSuggestionsChanged(self.category,
std::move(suggestionsOnly));
......@@ -276,11 +283,11 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) {
// Add 3 suggestions, persisted accross page loads.
std::vector<ContentSuggestion> suggestions;
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium1", GURL("http://chromium.org/1")));
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium2", GURL("http://chromium.org/2")));
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium3", GURL("http://chromium.org/3")));
self.provider->FireSuggestionsChanged(self.category, std::move(suggestions));
......@@ -339,7 +346,7 @@ GREYElementInteraction* CellWithMatcher(id<GREYMatcher> matcher) {
assertWithMatcher:grey_nil()];
std::vector<ContentSuggestion> suggestions;
suggestions.emplace_back(
suggestions.push_back(
Suggestion(self.category, "chromium", GURL("http://chromium.org")));
self.provider->FireSuggestionsChanged(self.category, std::move(suggestions));
......
......@@ -51,9 +51,17 @@
#error "This file requires ARC support."
#endif
using namespace content_suggestions;
using namespace ntp_home;
using namespace ntp_snippets;
using content_suggestions::searchFieldWidth;
using ntp_home::CollectionView;
using ntp_home::FakeOmnibox;
using ntp_home::OmniboxWidth;
using ntp_home::OmniboxWidthBetween;
using ntp_home::Suggestions;
using ntp_snippets::CategoryStatus;
using ntp_snippets::ContentSuggestionsService;
using ntp_snippets::CreateChromeContentSuggestionsService;
using ntp_snippets::KnownCategories;
using ntp_snippets::MockContentSuggestionsProvider;
namespace {
const char kPageLoadedString[] = "Page loaded!";
......@@ -410,7 +418,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
ReadingListModelFactory::GetForBrowserState(self.browserState)
->AddEntry(GURL("http://chromium.org/"), "title",
reading_list::ADDED_VIA_CURRENT_APP);
self.provider->FireSuggestionsChanged(self.category, ntp_home::Suggestions());
self.provider->FireSuggestionsChanged(self.category, Suggestions());
// Scroll to have a position to restored.
[[EarlGrey selectElementWithMatcher:chrome_test_util::
......@@ -418,7 +426,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
performAction:grey_scrollInDirection(kGREYDirectionDown, 150)];
// Save the position before navigating.
UIView* omnibox = ntp_home::FakeOmnibox();
UIView* omnibox = FakeOmnibox();
CGPoint previousPosition = omnibox.bounds.origin;
// Navigate and come back.
......@@ -430,7 +438,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
[ChromeEarlGrey goBack];
// Check that the new position is the same.
omnibox = ntp_home::FakeOmnibox();
omnibox = FakeOmnibox();
GREYAssertEqual(previousPosition.y, omnibox.bounds.origin.y,
@"Omnibox not at the same position");
}
......@@ -445,7 +453,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
ReadingListModelFactory::GetForBrowserState(self.browserState)
->AddEntry(GURL("http://chromium.org/"), "title",
reading_list::ADDED_VIA_CURRENT_APP);
self.provider->FireSuggestionsChanged(self.category, ntp_home::Suggestions());
self.provider->FireSuggestionsChanged(self.category, Suggestions());
// Scroll to have a position to restored.
[[EarlGrey selectElementWithMatcher:chrome_test_util::
......@@ -453,7 +461,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
performAction:grey_scrollInDirection(kGREYDirectionDown, 150)];
// Save the position before navigating.
UIView* omnibox = ntp_home::FakeOmnibox();
UIView* omnibox = FakeOmnibox();
CGPoint previousPosition = omnibox.bounds.origin;
// Tap the omnibox to focus it.
......@@ -468,7 +476,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
[ChromeEarlGrey goBack];
// Check that the new position is the same.
omnibox = ntp_home::FakeOmnibox();
omnibox = FakeOmnibox();
GREYAssertEqual(previousPosition.y, omnibox.bounds.origin.y,
@"Omnibox not at the same position");
}
......@@ -527,7 +535,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// Tests that tapping the fake omnibox moves the collection.
- (void)testTapFakeOmniboxScroll {
// Get the collection and its layout.
UIView* collection = ntp_home::CollectionView();
UIView* collection = CollectionView();
GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
@"The collection has not been correctly selected.");
UICollectionView* collectionView = (UICollectionView*)collection;
......@@ -556,7 +564,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
[[EarlGrey selectElementWithMatcher:chrome_test_util::FakeOmnibox()]
assertWithMatcher:grey_not(grey_sufficientlyVisible())];
CGFloat top = ntp_home::CollectionView().safeAreaInsets.top;
CGFloat top = CollectionView().safeAreaInsets.top;
GREYAssertTrue(offsetAfterTap.y >= origin.y + headerHeight - (60 + top),
@"The collection has not moved.");
......@@ -578,7 +586,7 @@ std::unique_ptr<net::test_server::HttpResponse> StandardResponse(
// back to where it was.
- (void)testTapFakeOmniboxScrollScrolled {
// Get the collection and its layout.
UIView* collection = ntp_home::CollectionView();
UIView* collection = CollectionView();
GREYAssertTrue([collection isKindOfClass:[UICollectionView class]],
@"The collection has not been correctly selected.");
UICollectionView* collectionView = (UICollectionView*)collection;
......
......@@ -16,7 +16,8 @@
#error "This file requires ARC support."
#endif
using namespace nsurlprotectionspace_util;
using nsurlprotectionspace_util::CanShow;
using nsurlprotectionspace_util::MessageForHTTPAuth;
namespace {
......
......@@ -43,8 +43,7 @@
#error "This file requires ARC support."
#endif
using namespace chrome_test_util;
using namespace scanner;
using scanner::CameraState;
namespace {
......@@ -74,7 +73,7 @@ id<GREYMatcher> VisibleInteractableEnabled() {
// Returns the GREYMatcher for the button that closes the QR Scanner.
id<GREYMatcher> QrScannerCloseButton() {
return ButtonWithAccessibilityLabel(
return chrome_test_util::ButtonWithAccessibilityLabel(
[[ChromeIcon closeIcon] accessibilityLabel]);
}
......@@ -100,7 +99,7 @@ id<GREYMatcher> QrScannerTorchOnButton() {
// Returns the GREYMatcher for the QR Scanner viewport caption.
id<GREYMatcher> QrScannerViewportCaption() {
return StaticTextWithAccessibilityLabelId(
return chrome_test_util::StaticTextWithAccessibilityLabelId(
IDS_IOS_QR_SCANNER_VIEWPORT_CAPTION);
}
......@@ -134,13 +133,13 @@ void TapButton(id<GREYMatcher> button) {
// Appends the given |editText| to the |text| already in the omnibox and presses
// the keyboard return key.
void EditOmniboxTextAndTapKeyboardReturn(std::string text, NSString* editText) {
[[EarlGrey selectElementWithMatcher:OmniboxText(text)]
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(text)]
performAction:grey_typeText([editText stringByAppendingString:@"\n"])];
}
// Presses the keyboard return key.
void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
[[EarlGrey selectElementWithMatcher:OmniboxText(text)]
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(text)]
performAction:grey_typeText(@"\n")];
}
......@@ -284,7 +283,7 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
// Checks that the omnibox is visible and contains |text|.
- (void)assertOmniboxIsVisibleWithText:(std::string)text {
[[EarlGrey selectElementWithMatcher:OmniboxText(text)]
[[EarlGrey selectElementWithMatcher:chrome_test_util::OmniboxText(text)]
assertWithMatcher:grey_notNil()];
}
......@@ -374,20 +373,20 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
- (NSString*)dialogTitleForState:(CameraState)state {
base::string16 appName = base::UTF8ToUTF16(version_info::GetProductName());
switch (state) {
case CAMERA_AVAILABLE:
case CAMERA_NOT_LOADED:
case scanner::CAMERA_AVAILABLE:
case scanner::CAMERA_NOT_LOADED:
return nil;
case CAMERA_IN_USE_BY_ANOTHER_APPLICATION:
case scanner::CAMERA_IN_USE_BY_ANOTHER_APPLICATION:
return l10n_util::GetNSString(
IDS_IOS_QR_SCANNER_CAMERA_IN_USE_ALERT_TITLE);
case CAMERA_PERMISSION_DENIED:
case scanner::CAMERA_PERMISSION_DENIED:
return l10n_util::GetNSString(
IDS_IOS_SCANNER_CAMERA_PERMISSIONS_HELP_TITLE_GO_TO_SETTINGS);
case CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE:
case CAMERA_UNAVAILABLE:
case scanner::CAMERA_UNAVAILABLE_DUE_TO_SYSTEM_PRESSURE:
case scanner::CAMERA_UNAVAILABLE:
return l10n_util::GetNSString(
IDS_IOS_QR_SCANNER_CAMERA_UNAVAILABLE_ALERT_TITLE);
case MULTIPLE_FOREGROUND_APPS:
case scanner::MULTIPLE_FOREGROUND_APPS:
return l10n_util::GetNSString(
IDS_IOS_QR_SCANNER_MULTIPLE_FOREGROUND_APPS_ALERT_TITLE);
}
......@@ -660,9 +659,10 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
AVAuthorizationStatusAuthorized];
[self swizzleCameraController:cameraControllerMock];
std::vector<CameraState> tests{MULTIPLE_FOREGROUND_APPS, CAMERA_UNAVAILABLE,
CAMERA_PERMISSION_DENIED,
CAMERA_IN_USE_BY_ANOTHER_APPLICATION};
std::vector<CameraState> tests{scanner::MULTIPLE_FOREGROUND_APPS,
scanner::CAMERA_UNAVAILABLE,
scanner::CAMERA_PERMISSION_DENIED,
scanner::CAMERA_IN_USE_BY_ANOTHER_APPLICATION};
for (const CameraState& state : tests) {
[self showQRScannerAndCheckLayoutWithCameraMock:cameraControllerMock];
......@@ -689,14 +689,15 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
[self swizzleCameraController:cameraControllerMock];
// Change state to CAMERA_UNAVAILABLE.
CameraState currentState = CAMERA_UNAVAILABLE;
CameraState currentState = scanner::CAMERA_UNAVAILABLE;
[self showQRScannerAndCheckLayoutWithCameraMock:cameraControllerMock];
[self callCameraStateChanged:currentState];
[self assertQRScannerIsPresentingADialogForState:currentState];
std::vector<CameraState> tests{
CAMERA_PERMISSION_DENIED, MULTIPLE_FOREGROUND_APPS,
CAMERA_IN_USE_BY_ANOTHER_APPLICATION, CAMERA_UNAVAILABLE};
std::vector<CameraState> tests{scanner::CAMERA_PERMISSION_DENIED,
scanner::MULTIPLE_FOREGROUND_APPS,
scanner::CAMERA_IN_USE_BY_ANOTHER_APPLICATION,
scanner::CAMERA_UNAVAILABLE};
for (const CameraState& state : tests) {
[self callCameraStateChanged:state];
......@@ -723,9 +724,10 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
AVAuthorizationStatusAuthorized];
[self swizzleCameraController:cameraControllerMock];
std::vector<CameraState> tests{CAMERA_IN_USE_BY_ANOTHER_APPLICATION,
CAMERA_UNAVAILABLE, MULTIPLE_FOREGROUND_APPS,
CAMERA_PERMISSION_DENIED};
std::vector<CameraState> tests{scanner::CAMERA_IN_USE_BY_ANOTHER_APPLICATION,
scanner::CAMERA_UNAVAILABLE,
scanner::MULTIPLE_FOREGROUND_APPS,
scanner::CAMERA_PERMISSION_DENIED};
for (const CameraState& state : tests) {
[self showQRScannerAndCheckLayoutWithCameraMock:cameraControllerMock];
......@@ -733,7 +735,7 @@ void TapKeyboardReturnKeyInOmniboxWithText(std::string text) {
[self assertQRScannerIsPresentingADialogForState:state];
// Change state to CAMERA_AVAILABLE.
[self callCameraStateChanged:CAMERA_AVAILABLE];
[self callCameraStateChanged:scanner::CAMERA_AVAILABLE];
[self assertQRScannerIsNotPresentingADialogForState:state];
[self closeQRScannerWithCameraMock:cameraControllerMock];
}
......
......@@ -18,7 +18,9 @@
#error "This file requires ARC support."
#endif
using namespace sync_encryption_passphrase;
using sync_encryption_passphrase::ItemTypeConfirmPassphrase;
using sync_encryption_passphrase::ItemTypeEnterPassphrase;
using sync_encryption_passphrase::SectionIdentifierPassphrase;
@interface SyncCreatePassphraseTableViewController () {
UITextField* confirmPassphrase_;
......
......@@ -42,7 +42,11 @@
#error "This file requires ARC support."
#endif
using namespace sync_encryption_passphrase;
using sync_encryption_passphrase::ItemTypeEnterPassphrase;
using sync_encryption_passphrase::ItemTypeError;
using sync_encryption_passphrase::ItemTypeFooter;
using sync_encryption_passphrase::ItemTypeMessage;
using sync_encryption_passphrase::SectionIdentifierPassphrase;
namespace {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment