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

Side by Side Diff: ios/chrome/browser/ui/qr_scanner/qr_scanner_view_controller_egtest.mm

Issue 2676803002: Remove the iOS QR Code scanner experiment code. (Closed)
Patch Set: Addressed comments. 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
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 <AVFoundation/AVFoundation.h> 5 #import <AVFoundation/AVFoundation.h>
6 #import <EarlGrey/EarlGrey.h> 6 #import <EarlGrey/EarlGrey.h>
7 #import <UIKit/UIKit.h> 7 #import <UIKit/UIKit.h>
8 8
9 #import "base/mac/scoped_nsobject.h" 9 #import "base/mac/scoped_nsobject.h"
10 #include "base/strings/sys_string_conversions.h" 10 #include "base/strings/sys_string_conversions.h"
11 #include "base/test/scoped_command_line.h"
12 #include "components/strings/grit/components_strings.h" 11 #include "components/strings/grit/components_strings.h"
13 #include "components/version_info/version_info.h" 12 #include "components/version_info/version_info.h"
14 #import "ios/chrome/app/main_controller.h" 13 #import "ios/chrome/app/main_controller.h"
15 #include "ios/chrome/browser/chrome_switches.h" 14 #include "ios/chrome/browser/chrome_switches.h"
16 #import "ios/chrome/browser/ui/browser_view_controller.h" 15 #import "ios/chrome/browser/ui/browser_view_controller.h"
17 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h" 16 #import "ios/chrome/browser/ui/commands/generic_chrome_command.h"
18 #include "ios/chrome/browser/ui/commands/ios_command_ids.h" 17 #include "ios/chrome/browser/ui/commands/ios_command_ids.h"
19 #include "ios/chrome/browser/ui/icons/chrome_icon.h" 18 #include "ios/chrome/browser/ui/icons/chrome_icon.h"
20 #include "ios/chrome/browser/ui/qr_scanner/camera_controller.h" 19 #include "ios/chrome/browser/ui/qr_scanner/camera_controller.h"
21 #include "ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h" 20 #include "ios/chrome/browser/ui/qr_scanner/qr_scanner_view.h"
(...skipping 116 matching lines...) Expand 10 before | Expand all | Expand 10 after
138 @interface QRScannerViewControllerTestCase : ChromeTestCase { 137 @interface QRScannerViewControllerTestCase : ChromeTestCase {
139 GURL _testURL; 138 GURL _testURL;
140 GURL _testURLEdited; 139 GURL _testURLEdited;
141 GURL _testQuery; 140 GURL _testQuery;
142 GURL _testQueryEdited; 141 GURL _testQueryEdited;
143 } 142 }
144 143
145 @end 144 @end
146 145
147 @implementation QRScannerViewControllerTestCase { 146 @implementation QRScannerViewControllerTestCase {
148 // A scoped command line to enable the QR Scanner experiment.
149 std::unique_ptr<base::test::ScopedCommandLine> scoped_command_line_;
150 // A swizzler for the CameraController method cameraControllerWithDelegate:. 147 // A swizzler for the CameraController method cameraControllerWithDelegate:.
151 std::unique_ptr<ScopedBlockSwizzler> camera_controller_swizzler_; 148 std::unique_ptr<ScopedBlockSwizzler> camera_controller_swizzler_;
152 // A swizzler for the WebToolbarController method 149 // A swizzler for the WebToolbarController method
153 // loadGURLFromLocationBar:transition:. 150 // loadGURLFromLocationBar:transition:.
154 std::unique_ptr<ScopedBlockSwizzler> load_GURL_from_location_bar_swizzler_; 151 std::unique_ptr<ScopedBlockSwizzler> load_GURL_from_location_bar_swizzler_;
155 } 152 }
156 153
157 + (void)setUp { 154 + (void)setUp {
158 [super setUp]; 155 [super setUp];
159 std::map<GURL, std::string> responses; 156 std::map<GURL, std::string> responses;
160 responses[web::test::HttpServer::MakeUrl(kTestURL)] = kTestURLResponse; 157 responses[web::test::HttpServer::MakeUrl(kTestURL)] = kTestURLResponse;
161 responses[web::test::HttpServer::MakeUrl(kTestQueryURL)] = kTestQueryResponse; 158 responses[web::test::HttpServer::MakeUrl(kTestQueryURL)] = kTestQueryResponse;
162 responses[web::test::HttpServer::MakeUrl(kTestURLEdited)] = 159 responses[web::test::HttpServer::MakeUrl(kTestURLEdited)] =
163 kTestURLEditedResponse; 160 kTestURLEditedResponse;
164 responses[web::test::HttpServer::MakeUrl(kTestQueryEditedURL)] = 161 responses[web::test::HttpServer::MakeUrl(kTestQueryEditedURL)] =
165 kTestQueryEditedResponse; 162 kTestQueryEditedResponse;
166 web::test::SetUpSimpleHttpServer(responses); 163 web::test::SetUpSimpleHttpServer(responses);
167 } 164 }
168 165
169 - (void)setUp { 166 - (void)setUp {
170 [super setUp]; 167 [super setUp];
171 _testURL = web::test::HttpServer::MakeUrl(kTestURL); 168 _testURL = web::test::HttpServer::MakeUrl(kTestURL);
172 _testURLEdited = web::test::HttpServer::MakeUrl(kTestURLEdited); 169 _testURLEdited = web::test::HttpServer::MakeUrl(kTestURLEdited);
173 _testQuery = web::test::HttpServer::MakeUrl(kTestQueryURL); 170 _testQuery = web::test::HttpServer::MakeUrl(kTestQueryURL);
174 _testQueryEdited = web::test::HttpServer::MakeUrl(kTestQueryEditedURL); 171 _testQueryEdited = web::test::HttpServer::MakeUrl(kTestQueryEditedURL);
175
176 // Enable the QR Scanner experiment.
177 scoped_command_line_.reset(new base::test::ScopedCommandLine);
178 scoped_command_line_->GetProcessCommandLine()->AppendSwitch(
179 switches::kEnableQRScanner);
180 } 172 }
181 173
182 - (void)tearDown { 174 - (void)tearDown {
183 [super tearDown]; 175 [super tearDown];
184 load_GURL_from_location_bar_swizzler_.reset(); 176 load_GURL_from_location_bar_swizzler_.reset();
185 camera_controller_swizzler_.reset(); 177 camera_controller_swizzler_.reset();
186 } 178 }
187 179
188 // Checks that the close button is visible, interactable, and enabled. 180 // Checks that the close button is visible, interactable, and enabled.
189 - (void)assertCloseButtonIsVisible { 181 - (void)assertCloseButtonIsVisible {
(...skipping 635 matching lines...) Expand 10 before | Expand all | Expand 10 after
825 // Test that the correct page is loaded if the scanner result is a search query 817 // Test that the correct page is loaded if the scanner result is a search query
826 // which is then manually edited. 818 // which is then manually edited.
827 - (void)testReceivingQRScannerSearchQueryResultAndEditingTheQuery { 819 - (void)testReceivingQRScannerSearchQueryResultAndEditingTheQuery {
828 [self swizzleWebToolbarControllerLoadGURLFromLocationBar:_testQueryEdited]; 820 [self swizzleWebToolbarControllerLoadGURLFromLocationBar:_testQueryEdited];
829 [self doTestReceivingResult:kTestQuery 821 [self doTestReceivingResult:kTestQuery
830 response:kTestQueryEditedResponse 822 response:kTestQueryEditedResponse
831 edit:@"\bedited"]; 823 edit:@"\bedited"];
832 } 824 }
833 825
834 @end 826 @end
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698