summaryrefslogtreecommitdiffstats
path: root/chrome/browser/printing/print_dialog_cloud_unittest.cc
diff options
context:
space:
mode:
authorscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-04 16:35:58 +0000
committerscottbyer@chromium.org <scottbyer@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98>2010-06-04 16:35:58 +0000
commitc2b1122fe332847e3fcaab2e1383c1ccb32b6e05 (patch)
tree08b67b34e38c15ceaf66827ca9d45a15d2ca135b /chrome/browser/printing/print_dialog_cloud_unittest.cc
parentc80e9841c2dc96cc4d4048ca74ee16f7903e5d42 (diff)
downloadchromium_src-c2b1122fe332847e3fcaab2e1383c1ccb32b6e05.zip
chromium_src-c2b1122fe332847e3fcaab2e1383c1ccb32b6e05.tar.gz
chromium_src-c2b1122fe332847e3fcaab2e1383c1ccb32b6e05.tar.bz2
Re-enable test, add in test detail.
Add in asked-for test of getting the title through, found text-only PDF file for that test, re-enabled it. BUG=none TEST=CloudPrintDataSenderTest.CanSend Review URL: http://codereview.chromium.org/2590002 git-svn-id: svn://svn.chromium.org/chrome/trunk/src@48935 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'chrome/browser/printing/print_dialog_cloud_unittest.cc')
-rw-r--r--chrome/browser/printing/print_dialog_cloud_unittest.cc26
1 files changed, 21 insertions, 5 deletions
diff --git a/chrome/browser/printing/print_dialog_cloud_unittest.cc b/chrome/browser/printing/print_dialog_cloud_unittest.cc
index 8fb0aa5..5a1c669 100644
--- a/chrome/browser/printing/print_dialog_cloud_unittest.cc
+++ b/chrome/browser/printing/print_dialog_cloud_unittest.cc
@@ -8,6 +8,7 @@
#include "base/file_path.h"
#include "base/file_util.h"
#include "base/path_service.h"
+#include "base/string_util.h"
#include "base/values.h"
#include "base/weak_ptr.h"
#include "chrome/browser/chrome_thread.h"
@@ -24,6 +25,7 @@
using testing::A;
using testing::AtLeast;
+using testing::Eq;
using testing::HasSubstr;
using testing::IsNull;
using testing::NotNull;
@@ -34,6 +36,7 @@ using testing::_;
static const char* const kPDFTestFile = "printing/cloud_print_unittest.pdf";
static const char* const kEmptyPDFTestFile =
"printing/cloud_print_emptytest.pdf";
+static const char* const kMockJobTitle = "Mock Job Title";
FilePath GetTestDataFileName() {
FilePath test_data_directory;
@@ -58,6 +61,17 @@ char* GetTestData() {
return &sTestFileData[0];
}
+MATCHER_P(StringValueEq, expected, "StringValue") {
+ if (expected->Equals(&arg))
+ return true;
+ std::string expected_string, arg_string;
+ expected->GetAsString(&expected_string);
+ arg.GetAsString(&arg_string);
+ *result_listener << "'" << arg_string
+ << "' (expected '" << expected_string << "')";
+ return false;
+}
+
namespace internal_cloud_print_helpers {
class MockCloudPrintFlowHandler
@@ -172,7 +186,7 @@ class CloudPrintDataSenderTest : public testing::Test {
protected:
virtual void SetUp() {
- string16 mock_job_title;
+ string16 mock_job_title(ASCIIToUTF16(kMockJobTitle));
mock_helper_.reset(new MockCloudPrintDataSenderHelper);
print_data_sender_ =
new CloudPrintDataSender(mock_helper_.get(), mock_job_title);
@@ -188,8 +202,10 @@ class CloudPrintDataSenderTest : public testing::Test {
// TODO(scottbyer): DISABLED until the binary test file can get
// checked in separate from the patch.
-TEST_F(CloudPrintDataSenderTest, DISABLED_CanSend) {
- EXPECT_CALL(*mock_helper_, CallJavascriptFunction(_, _, _)).
+TEST_F(CloudPrintDataSenderTest, CanSend) {
+ StringValue mock_job_title(kMockJobTitle);
+ EXPECT_CALL(*mock_helper_,
+ CallJavascriptFunction(_, _, StringValueEq(&mock_job_title))).
WillOnce(Return());
FilePath test_data_file_name = GetTestDataFileName();
@@ -247,9 +263,9 @@ class CloudPrintHtmlDialogDelegateTest : public testing::Test {
protected:
virtual void SetUp() {
FilePath mock_path;
- string16 mock_string;
+ string16 mock_title;
MockCloudPrintFlowHandler* handler =
- new MockCloudPrintFlowHandler(mock_path, mock_string);
+ new MockCloudPrintFlowHandler(mock_path, mock_title);
mock_flow_handler_ = handler->AsWeakPtr();
EXPECT_CALL(*mock_flow_handler_.get(), SetDialogDelegate(_));
EXPECT_CALL(*mock_flow_handler_.get(), SetDialogDelegate(NULL));