OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <string> | 8 #include <string> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 302 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
313 | 313 |
314 MessageLoopForUI message_loop_; | 314 MessageLoopForUI message_loop_; |
315 BrowserThread ui_thread_; | 315 BrowserThread ui_thread_; |
316 base::WeakPtr<MockCloudPrintFlowHandler> mock_flow_handler_; | 316 base::WeakPtr<MockCloudPrintFlowHandler> mock_flow_handler_; |
317 scoped_ptr<CloudPrintHtmlDialogDelegate> delegate_; | 317 scoped_ptr<CloudPrintHtmlDialogDelegate> delegate_; |
318 }; | 318 }; |
319 | 319 |
320 TEST_F(CloudPrintHtmlDialogDelegateTest, BasicChecks) { | 320 TEST_F(CloudPrintHtmlDialogDelegateTest, BasicChecks) { |
321 EXPECT_TRUE(delegate_->IsDialogModal()); | 321 EXPECT_TRUE(delegate_->IsDialogModal()); |
322 EXPECT_THAT(delegate_->GetDialogContentURL().spec(), | 322 EXPECT_THAT(delegate_->GetDialogContentURL().spec(), |
323 StrEq(chrome::kChromeUICloudPrintResourcesURL)); | 323 StrEq(chrome::kCloudPrintResourcesURL)); |
324 EXPECT_TRUE(delegate_->GetDialogTitle().empty()); | 324 EXPECT_TRUE(delegate_->GetDialogTitle().empty()); |
325 | 325 |
326 bool close_dialog = false; | 326 bool close_dialog = false; |
327 delegate_->OnCloseContents(NULL, &close_dialog); | 327 delegate_->OnCloseContents(NULL, &close_dialog); |
328 EXPECT_TRUE(close_dialog); | 328 EXPECT_TRUE(close_dialog); |
329 } | 329 } |
330 | 330 |
331 TEST_F(CloudPrintHtmlDialogDelegateTest, OwnedFlowDestroyed) { | 331 TEST_F(CloudPrintHtmlDialogDelegateTest, OwnedFlowDestroyed) { |
332 delegate_.reset(); | 332 delegate_.reset(); |
333 EXPECT_THAT(mock_flow_handler_.get(), IsNull()); | 333 EXPECT_THAT(mock_flow_handler_.get(), IsNull()); |
334 } | 334 } |
335 | 335 |
336 TEST_F(CloudPrintHtmlDialogDelegateTest, UnownedFlowLetGo) { | 336 TEST_F(CloudPrintHtmlDialogDelegateTest, UnownedFlowLetGo) { |
337 std::vector<WebUIMessageHandler*> handlers; | 337 std::vector<WebUIMessageHandler*> handlers; |
338 delegate_->GetWebUIMessageHandlers(&handlers); | 338 delegate_->GetWebUIMessageHandlers(&handlers); |
339 delegate_.reset(); | 339 delegate_.reset(); |
340 EXPECT_THAT(mock_flow_handler_.get(), NotNull()); | 340 EXPECT_THAT(mock_flow_handler_.get(), NotNull()); |
341 } | 341 } |
342 | 342 |
343 // Testing for ExternalHtmlDialogUI needs a mock TabContents, mock | 343 // Testing for ExternalHtmlDialogUI needs a mock TabContents, mock |
344 // CloudPrintHtmlDialogDelegate (provided through the mock | 344 // CloudPrintHtmlDialogDelegate (provided through the mock |
345 // tab_contents) | 345 // tab_contents) |
346 | 346 |
347 // Testing for PrintDialogCloud needs a mock Browser. | 347 // Testing for PrintDialogCloud needs a mock Browser. |
OLD | NEW |