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

Unified Diff: extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc

Issue 899523004: Move chrome.documentScan API to extensions/ (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: Updated DEPS Created 5 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 side-by-side diff with in-line comments
Download patch
Index: extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
diff --git a/chrome/browser/extensions/api/document_scan/document_scan_interface_chromeos_unittest.cc b/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
similarity index 62%
rename from chrome/browser/extensions/api/document_scan/document_scan_interface_chromeos_unittest.cc
rename to extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
index cbc51218b246c63ed66632d0cfde1dcae8c80bd0..e34de361999fd2624f9f60b224692f2896cc14db 100644
--- a/chrome/browser/extensions/api/document_scan/document_scan_interface_chromeos_unittest.cc
+++ b/extensions/browser/api/document_scan/document_scan_interface_chromeos_unittest.cc
@@ -1,7 +1,8 @@
// Copyright 2014 The Chromium Authors. All rights reserved.
// Use of this source code is governed by a BSD-style license that can be
// found in the LICENSE file.
-#include "chrome/browser/extensions/api/document_scan/document_scan_interface_chromeos.h"
+
+#include "extensions/browser/api/document_scan/document_scan_interface_chromeos.h"
#include <string>
#include <vector>
@@ -15,7 +16,7 @@ using testing::_;
namespace extensions {
-namespace api {
+namespace core_api {
// Tests of networking_private_crypto support for Networking Private API.
class DocumentScanInterfaceChromeosTest : public testing::Test {
@@ -28,15 +29,15 @@ class DocumentScanInterfaceChromeosTest : public testing::Test {
scan_interface_.lorgnette_manager_client_ = client_.get();
}
- MOCK_METHOD2(
- OnListScannersResultReceived,
- void(const std::vector<DocumentScanInterface::ScannerDescription>&
- scanners,
- const std::string& error));
+ MOCK_METHOD2(OnListScannersResultReceived,
+ void(const std::vector<
+ DocumentScanInterface::ScannerDescription>& scanners,
+ const std::string& error));
- MOCK_METHOD3(OnScanCompleted, void(const std::string& scanned_image,
- const std::string& mime_type,
- const std::string& error));
+ MOCK_METHOD3(OnScanCompleted,
+ void(const std::string& scanned_image,
+ const std::string& mime_type,
+ const std::string& error));
protected:
DocumentScanInterfaceChromeos scan_interface_;
@@ -52,12 +53,9 @@ ACTION_P2(InvokeScanCallback, succeeded, image_data) {
}
MATCHER_P5(IsScannerDescription, name, manufacturer, model, type, mime, "") {
- return
- arg.name == name &&
- arg.manufacturer == manufacturer &&
- arg.model == model &&
- arg.scanner_type == type &&
- arg.image_mime_type == mime;
+ return arg.name == name && arg.manufacturer == manufacturer &&
+ arg.model == model && arg.scanner_type == type &&
+ arg.image_mime_type == mime;
}
MATCHER_P2(IsScannerProperties, mode, resolution, "") {
@@ -78,12 +76,10 @@ TEST_F(DocumentScanInterfaceChromeosTest, ListScanners) {
EXPECT_CALL(*client_, ListScanners(_))
.WillOnce(InvokeListScannersCallback(true, scanners));
EXPECT_CALL(*this, OnListScannersResultReceived(
- testing::ElementsAre(
- IsScannerDescription(kScannerName,
- kScannerManufacturer,
- kScannerModel,
- kScannerType,
- "image/png")), ""));
+ testing::ElementsAre(IsScannerDescription(
+ kScannerName, kScannerManufacturer, kScannerModel,
+ kScannerType, "image/png")),
+ ""));
scan_interface_.ListScanners(base::Bind(
&DocumentScanInterfaceChromeosTest::OnListScannersResultReceived,
base::Unretained(this)));
@@ -95,32 +91,25 @@ TEST_F(DocumentScanInterfaceChromeosTest, ScanFailure) {
EXPECT_CALL(*client_, ScanImageToString(
kScannerName,
IsScannerProperties(
- lorgnette::kScanPropertyModeColor,
- kResolution),
+ lorgnette::kScanPropertyModeColor, kResolution),
_)).WillOnce(InvokeScanCallback(false, ""));
- EXPECT_CALL(*this, OnScanCompleted("data:image/png;base64,",
- "image/png",
+ EXPECT_CALL(*this, OnScanCompleted("data:image/png;base64,", "image/png",
"Image scan failed"));
scan_interface_.Scan(
- kScannerName,
- DocumentScanInterface::kScanModeColor,
- kResolution,
- base::Bind(
- &DocumentScanInterfaceChromeosTest::OnScanCompleted,
- base::Unretained(this)));
+ kScannerName, DocumentScanInterface::kScanModeColor, kResolution,
+ base::Bind(&DocumentScanInterfaceChromeosTest::OnScanCompleted,
+ base::Unretained(this)));
}
TEST_F(DocumentScanInterfaceChromeosTest, ScanSuccess) {
const char kScannerName[] = "Monet";
const int kResolution = 4096;
- EXPECT_CALL(*client_,
- ScanImageToString(
- kScannerName,
- IsScannerProperties(
- lorgnette::kScanPropertyModeColor,
- kResolution),
- _))
- .WillOnce(InvokeScanCallback(true, std::string("PrettyPicture")));
+ EXPECT_CALL(
+ *client_,
+ ScanImageToString(
+ kScannerName,
+ IsScannerProperties(lorgnette::kScanPropertyModeColor, kResolution),
+ _)).WillOnce(InvokeScanCallback(true, std::string("PrettyPicture")));
// Data URL plus base64 representation of "PrettyPicture".
const char kExpectedImageData[] =
@@ -128,14 +117,11 @@ TEST_F(DocumentScanInterfaceChromeosTest, ScanSuccess) {
EXPECT_CALL(*this, OnScanCompleted(kExpectedImageData, "image/png", ""));
scan_interface_.Scan(
- kScannerName,
- DocumentScanInterface::kScanModeColor,
- kResolution,
- base::Bind(
- &DocumentScanInterfaceChromeosTest::OnScanCompleted,
- base::Unretained(this)));
+ kScannerName, DocumentScanInterface::kScanModeColor, kResolution,
+ base::Bind(&DocumentScanInterfaceChromeosTest::OnScanCompleted,
+ base::Unretained(this)));
}
-} // namespace api
+} // namespace core_api
} // namespace extensions

Powered by Google App Engine
This is Rietveld 408576698