Commit a94dd8da authored by Robert Sesek's avatar Robert Sesek Committed by Chromium LUCI CQ

mac: Remove code to support OS X 10.10 in //services/shape_detection

Bug: 1153883
Change-Id: Ic1e2dc39b96c2c5ed1e80c4732e1a2dcee02b675
Reviewed-on: https://chromium-review.googlesource.com/c/chromium/src/+/2571801Reviewed-by: default avatarMiguel Casas <mcasas@chromium.org>
Reviewed-by: default avatarReilly Grant <reillyg@chromium.org>
Commit-Queue: Robert Sesek <rsesek@chromium.org>
Cr-Commit-Position: refs/heads/master@{#833422}
parent 08e07eab
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
namespace shape_detection { namespace shape_detection {
class API_AVAILABLE(macosx(10.10)) BarcodeDetectionImplMac class BarcodeDetectionImplMac
: public shape_detection::mojom::BarcodeDetection { : public shape_detection::mojom::BarcodeDetection {
public: public:
BarcodeDetectionImplMac(); BarcodeDetectionImplMac();
......
...@@ -120,11 +120,6 @@ TEST_P(BarcodeDetectionImplMacTest, ScanOneBarcode) { ...@@ -120,11 +120,6 @@ TEST_P(BarcodeDetectionImplMacTest, ScanOneBarcode) {
} }
impl_ = GetParam().factory.Run(mojom::BarcodeDetectorOptions::New()); impl_ = GetParam().factory.Run(mojom::BarcodeDetectorOptions::New());
if (!impl_) {
LOG(WARNING) << "Barcode Detection is not supported before Mac OSX 10.10."
<< "Skipping test.";
return;
}
// Generate a barcode image as a CIImage by using |qr_code_generator|. // Generate a barcode image as a CIImage by using |qr_code_generator|.
NSData* const qr_code_data = NSData* const qr_code_data =
......
...@@ -4,7 +4,6 @@ ...@@ -4,7 +4,6 @@
#include "services/shape_detection/text_detection_impl_mac.h" #include "services/shape_detection/text_detection_impl_mac.h"
#include "base/mac/mac_util.h"
#include "base/mac/scoped_cftyperef.h" #include "base/mac/scoped_cftyperef.h"
#include "base/strings/sys_string_conversions.h" #include "base/strings/sys_string_conversions.h"
#include "mojo/public/cpp/bindings/pending_receiver.h" #include "mojo/public/cpp/bindings/pending_receiver.h"
...@@ -17,11 +16,8 @@ namespace shape_detection { ...@@ -17,11 +16,8 @@ namespace shape_detection {
// static // static
void TextDetectionImpl::Create( void TextDetectionImpl::Create(
mojo::PendingReceiver<mojom::TextDetection> receiver) { mojo::PendingReceiver<mojom::TextDetection> receiver) {
// Text detection needs at least MAC OS X 10.11.
if (@available(macOS 10.11, *)) {
mojo::MakeSelfOwnedReceiver(std::make_unique<TextDetectionImplMac>(), mojo::MakeSelfOwnedReceiver(std::make_unique<TextDetectionImplMac>(),
std::move(receiver)); std::move(receiver));
}
} }
TextDetectionImplMac::TextDetectionImplMac() { TextDetectionImplMac::TextDetectionImplMac() {
...@@ -35,8 +31,6 @@ TextDetectionImplMac::~TextDetectionImplMac() {} ...@@ -35,8 +31,6 @@ TextDetectionImplMac::~TextDetectionImplMac() {}
void TextDetectionImplMac::Detect(const SkBitmap& bitmap, void TextDetectionImplMac::Detect(const SkBitmap& bitmap,
DetectCallback callback) { DetectCallback callback) {
DCHECK(base::mac::IsAtLeastOS10_11());
base::scoped_nsobject<CIImage> ci_image = CreateCIImageFromSkBitmap(bitmap); base::scoped_nsobject<CIImage> ci_image = CreateCIImageFromSkBitmap(bitmap);
if (!ci_image) { if (!ci_image) {
std::move(callback).Run({}); std::move(callback).Run({});
......
...@@ -41,14 +41,12 @@ TEST_F(TextDetectionImplMacTest, CreateAndDestroy) {} ...@@ -41,14 +41,12 @@ TEST_F(TextDetectionImplMacTest, CreateAndDestroy) {}
// This test generates an image with a single text line and scans it back. // This test generates an image with a single text line and scans it back.
TEST_F(TextDetectionImplMacTest, ScanOnce) { TEST_F(TextDetectionImplMacTest, ScanOnce) {
// Text detection needs at least MAC OS X 10.11, and GPU infrastructure. // Text detection needs GPU infrastructure.
if (!base::CommandLine::ForCurrentProcess()->HasSwitch( if (!base::CommandLine::ForCurrentProcess()->HasSwitch(
switches::kUseGpuInTests) || switches::kUseGpuInTests)) {
!base::mac::IsAtLeastOS10_11()) {
return; return;
} }
if (@available(macOS 10.11, *)) {
impl_.reset(new TextDetectionImplMac); impl_.reset(new TextDetectionImplMac);
base::ScopedCFTypeRef<CGColorSpaceRef> rgb_colorspace( base::ScopedCFTypeRef<CGColorSpaceRef> rgb_colorspace(
CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB)); CGColorSpaceCreateWithName(kCGColorSpaceGenericRGB));
...@@ -65,8 +63,8 @@ TEST_F(TextDetectionImplMacTest, ScanOnce) { ...@@ -65,8 +63,8 @@ TEST_F(TextDetectionImplMacTest, ScanOnce) {
CGContextFillRect(context, CGRectMake(0.0, 0.0, width, height)); CGContextFillRect(context, CGRectMake(0.0, 0.0, width, height));
// Create a line of Helvetica 16 text, and draw it in the |context|. // Create a line of Helvetica 16 text, and draw it in the |context|.
base::scoped_nsobject<NSFont> helvetica( base::scoped_nsobject<NSFont> helvetica([NSFont fontWithName:@"Helvetica"
[NSFont fontWithName:@"Helvetica" size:16]); size:16]);
NSDictionary* attributes = [NSDictionary NSDictionary* attributes = [NSDictionary
dictionaryWithObjectsAndKeys:helvetica, kCTFontAttributeName, nil]; dictionaryWithObjectsAndKeys:helvetica, kCTFontAttributeName, nil];
...@@ -98,7 +96,6 @@ TEST_F(TextDetectionImplMacTest, ScanOnce) { ...@@ -98,7 +96,6 @@ TEST_F(TextDetectionImplMacTest, ScanOnce) {
base::Unretained(this))); base::Unretained(this)));
run_loop.Run(); run_loop.Run();
}
} }
} // shape_detection namespace } // shape_detection 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