OLD | NEW |
1 // Copyright (c) 2009 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 #import "chrome/browser/cocoa/html_dialog_window_controller.h" | 5 #import "chrome/browser/cocoa/html_dialog_window_controller.h" |
6 | 6 |
7 #include <string> | 7 #include <string> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #import <Cocoa/Cocoa.h> | 10 #import <Cocoa/Cocoa.h> |
11 | 11 |
12 #import "base/scoped_nsautorelease_pool.h" | 12 #import "base/mac/scoped_nsautorelease_pool.h" |
13 #include "base/sys_string_conversions.h" | 13 #include "base/sys_string_conversions.h" |
14 #include "chrome/browser/cocoa/cocoa_test_helper.h" | 14 #include "chrome/browser/cocoa/cocoa_test_helper.h" |
15 #include "chrome/browser/dom_ui/dom_ui.h" | 15 #include "chrome/browser/dom_ui/dom_ui.h" |
16 #include "chrome/browser/dom_ui/html_dialog_ui.h" | 16 #include "chrome/browser/dom_ui/html_dialog_ui.h" |
17 #include "chrome/test/browser_with_test_window_test.h" | 17 #include "chrome/test/browser_with_test_window_test.h" |
18 #include "chrome/test/testing_profile.h" | 18 #include "chrome/test/testing_profile.h" |
19 #include "gfx/size.h" | 19 #include "gfx/size.h" |
20 #include "googleurl/src/gurl.h" | 20 #include "googleurl/src/gurl.h" |
21 #include "testing/gmock/include/gmock/gmock.h" | 21 #include "testing/gmock/include/gmock/gmock.h" |
22 #include "testing/gtest/include/gtest/gtest.h" | 22 #include "testing/gtest/include/gtest/gtest.h" |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
63 // TODO(akalin): We can't test much more than the below without a real browser. | 63 // TODO(akalin): We can't test much more than the below without a real browser. |
64 // In particular, GetDOMMessageHandlers() and GetDialogArgs() are never called. | 64 // In particular, GetDOMMessageHandlers() and GetDialogArgs() are never called. |
65 // This should be fixed. | 65 // This should be fixed. |
66 | 66 |
67 TEST_F(HtmlDialogWindowControllerTest, showDialog) { | 67 TEST_F(HtmlDialogWindowControllerTest, showDialog) { |
68 // We want to make sure html_dialog_window_controller below gets | 68 // We want to make sure html_dialog_window_controller below gets |
69 // destroyed before delegate_, so we specify our own autorelease pool. | 69 // destroyed before delegate_, so we specify our own autorelease pool. |
70 // | 70 // |
71 // TODO(dmaclach): Remove this once | 71 // TODO(dmaclach): Remove this once |
72 // http://code.google.com/p/chromium/issues/detail?id=26133 is fixed. | 72 // http://code.google.com/p/chromium/issues/detail?id=26133 is fixed. |
73 base::ScopedNSAutoreleasePool release_pool; | 73 base::mac::ScopedNSAutoreleasePool release_pool; |
74 | 74 |
75 EXPECT_CALL(delegate_, GetDialogTitle()) | 75 EXPECT_CALL(delegate_, GetDialogTitle()) |
76 .WillOnce(Return(title_)); | 76 .WillOnce(Return(title_)); |
77 EXPECT_CALL(delegate_, GetDialogSize(_)) | 77 EXPECT_CALL(delegate_, GetDialogSize(_)) |
78 .WillOnce(SetArgumentPointee<0>(size_)); | 78 .WillOnce(SetArgumentPointee<0>(size_)); |
79 EXPECT_CALL(delegate_, GetDialogContentURL()) | 79 EXPECT_CALL(delegate_, GetDialogContentURL()) |
80 .WillOnce(Return(gurl_)); | 80 .WillOnce(Return(gurl_)); |
81 EXPECT_CALL(delegate_, OnDialogClosed(_)) | 81 EXPECT_CALL(delegate_, OnDialogClosed(_)) |
82 .Times(1); | 82 .Times(1); |
83 | 83 |
84 HtmlDialogWindowController* html_dialog_window_controller = | 84 HtmlDialogWindowController* html_dialog_window_controller = |
85 [[HtmlDialogWindowController alloc] initWithDelegate:&delegate_ | 85 [[HtmlDialogWindowController alloc] initWithDelegate:&delegate_ |
86 profile:profile()]; | 86 profile:profile()]; |
87 | 87 |
88 [html_dialog_window_controller loadDialogContents]; | 88 [html_dialog_window_controller loadDialogContents]; |
89 [html_dialog_window_controller showWindow:nil]; | 89 [html_dialog_window_controller showWindow:nil]; |
90 [html_dialog_window_controller close]; | 90 [html_dialog_window_controller close]; |
91 } | 91 } |
92 | 92 |
93 } // namespace | 93 } // namespace |
OLD | NEW |