| OLD | NEW |
| 1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2010 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 #include "chrome/browser/printing/print_dialog_cloud.h" | 5 #include "chrome/browser/printing/print_dialog_cloud.h" |
| 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" | 6 #include "chrome/browser/printing/print_dialog_cloud_internal.h" |
| 7 | 7 |
| 8 #include "base/file_path.h" | 8 #include "base/file_path.h" |
| 9 #include "base/file_util.h" | 9 #include "base/file_util.h" |
| 10 #include "base/path_service.h" | 10 #include "base/path_service.h" |
| (...skipping 282 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 293 MessageLoopForUI message_loop_; | 293 MessageLoopForUI message_loop_; |
| 294 BrowserThread ui_thread_; | 294 BrowserThread ui_thread_; |
| 295 base::WeakPtr<MockCloudPrintFlowHandler> mock_flow_handler_; | 295 base::WeakPtr<MockCloudPrintFlowHandler> mock_flow_handler_; |
| 296 scoped_ptr<CloudPrintHtmlDialogDelegate> delegate_; | 296 scoped_ptr<CloudPrintHtmlDialogDelegate> delegate_; |
| 297 }; | 297 }; |
| 298 | 298 |
| 299 TEST_F(CloudPrintHtmlDialogDelegateTest, BasicChecks) { | 299 TEST_F(CloudPrintHtmlDialogDelegateTest, BasicChecks) { |
| 300 EXPECT_TRUE(delegate_->IsDialogModal()); | 300 EXPECT_TRUE(delegate_->IsDialogModal()); |
| 301 EXPECT_THAT(delegate_->GetDialogContentURL().spec(), | 301 EXPECT_THAT(delegate_->GetDialogContentURL().spec(), |
| 302 StrEq(chrome::kCloudPrintResourcesURL)); | 302 StrEq(chrome::kCloudPrintResourcesURL)); |
| 303 EXPECT_THAT(delegate_->GetDialogTitle(), HasSubstr(L"Print")); | 303 EXPECT_TRUE(delegate_->GetDialogTitle().empty()); |
| 304 | 304 |
| 305 bool close_dialog = false; | 305 bool close_dialog = false; |
| 306 delegate_->OnCloseContents(NULL, &close_dialog); | 306 delegate_->OnCloseContents(NULL, &close_dialog); |
| 307 EXPECT_TRUE(close_dialog); | 307 EXPECT_TRUE(close_dialog); |
| 308 } | 308 } |
| 309 | 309 |
| 310 TEST_F(CloudPrintHtmlDialogDelegateTest, OwnedFlowDestroyed) { | 310 TEST_F(CloudPrintHtmlDialogDelegateTest, OwnedFlowDestroyed) { |
| 311 delegate_.reset(); | 311 delegate_.reset(); |
| 312 EXPECT_THAT(mock_flow_handler_.get(), IsNull()); | 312 EXPECT_THAT(mock_flow_handler_.get(), IsNull()); |
| 313 } | 313 } |
| 314 | 314 |
| 315 TEST_F(CloudPrintHtmlDialogDelegateTest, UnownedFlowLetGo) { | 315 TEST_F(CloudPrintHtmlDialogDelegateTest, UnownedFlowLetGo) { |
| 316 std::vector<DOMMessageHandler*> handlers; | 316 std::vector<DOMMessageHandler*> handlers; |
| 317 delegate_->GetDOMMessageHandlers(&handlers); | 317 delegate_->GetDOMMessageHandlers(&handlers); |
| 318 delegate_.reset(); | 318 delegate_.reset(); |
| 319 EXPECT_THAT(mock_flow_handler_.get(), NotNull()); | 319 EXPECT_THAT(mock_flow_handler_.get(), NotNull()); |
| 320 } | 320 } |
| 321 | 321 |
| 322 // Testing for ExternalHtmlDialogUI needs a mock TabContents, mock | 322 // Testing for ExternalHtmlDialogUI needs a mock TabContents, mock |
| 323 // CloudPrintHtmlDialogDelegate (provided through the mock | 323 // CloudPrintHtmlDialogDelegate (provided through the mock |
| 324 // tab_contents) | 324 // tab_contents) |
| 325 | 325 |
| 326 // Testing for PrintDialogCloud needs a mock Browser. | 326 // Testing for PrintDialogCloud needs a mock Browser. |
| OLD | NEW |