| OLD | NEW |
| 1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <functional> | 8 #include <functional> |
| 9 | 9 |
| 10 #include "base/bind.h" | 10 #include "base/bind.h" |
| (...skipping 101 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 112 } | 112 } |
| 113 bool result() { | 113 bool result() { |
| 114 return result_; | 114 return result_; |
| 115 } | 115 } |
| 116 void set_expected_url(const GURL& url) { | 116 void set_expected_url(const GURL& url) { |
| 117 expected_url_ = url; | 117 expected_url_ = url; |
| 118 } | 118 } |
| 119 const GURL expected_url() { | 119 const GURL expected_url() { |
| 120 return expected_url_; | 120 return expected_url_; |
| 121 } | 121 } |
| 122 void set_delegate(net::TestDelegate* delegate) { | 122 void set_delegate(TestDelegate* delegate) { |
| 123 delegate_ = delegate; | 123 delegate_ = delegate; |
| 124 } | 124 } |
| 125 net::TestDelegate* delegate() { | 125 TestDelegate* delegate() { |
| 126 return delegate_; | 126 return delegate_; |
| 127 } | 127 } |
| 128 void set_use_delegate(bool value) { | 128 void set_use_delegate(bool value) { |
| 129 use_delegate_ = value; | 129 use_delegate_ = value; |
| 130 } | 130 } |
| 131 bool use_delegate() { | 131 bool use_delegate() { |
| 132 return use_delegate_; | 132 return use_delegate_; |
| 133 } | 133 } |
| 134 private: | 134 private: |
| 135 TestController() | 135 TestController() |
| 136 : result_(false), | 136 : result_(false), |
| 137 use_delegate_(false), | 137 use_delegate_(false), |
| 138 delegate_(NULL) {} | 138 delegate_(NULL) {} |
| 139 | 139 |
| 140 bool result_; | 140 bool result_; |
| 141 bool use_delegate_; | 141 bool use_delegate_; |
| 142 GURL expected_url_; | 142 GURL expected_url_; |
| 143 net::TestDelegate* delegate_; | 143 TestDelegate* delegate_; |
| 144 | 144 |
| 145 friend struct DefaultSingletonTraits<TestController>; | 145 friend struct DefaultSingletonTraits<TestController>; |
| 146 }; | 146 }; |
| 147 | 147 |
| 148 } // namespace | 148 } // namespace |
| 149 | 149 |
| 150 class PrintDialogCloudTest : public InProcessBrowserTest { | 150 class PrintDialogCloudTest : public InProcessBrowserTest { |
| 151 public: | 151 public: |
| 152 PrintDialogCloudTest() : handler_added_(false) { | 152 PrintDialogCloudTest() : handler_added_(false) { |
| 153 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); | 153 PathService::Get(chrome::DIR_TEST_DATA, &test_data_directory_); |
| 154 } | 154 } |
| 155 | 155 |
| 156 // Must be static for handing into AddHostnameHandler. | 156 // Must be static for handing into AddHostnameHandler. |
| 157 static net::URLRequest::ProtocolFactory Factory; | 157 static net::URLRequest::ProtocolFactory Factory; |
| 158 | 158 |
| 159 class AutoQuitDelegate : public net::TestDelegate { | 159 class AutoQuitDelegate : public TestDelegate { |
| 160 public: | 160 public: |
| 161 AutoQuitDelegate() {} | 161 AutoQuitDelegate() {} |
| 162 | 162 |
| 163 virtual void OnResponseCompleted(net::URLRequest* request) { | 163 virtual void OnResponseCompleted(net::URLRequest* request) { |
| 164 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, | 164 BrowserThread::PostTask(BrowserThread::UI, FROM_HERE, |
| 165 MessageLoop::QuitClosure()); | 165 MessageLoop::QuitClosure()); |
| 166 } | 166 } |
| 167 }; | 167 }; |
| 168 | 168 |
| 169 virtual void SetUp() { | 169 virtual void SetUp() { |
| (...skipping 98 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 268 BrowserWindow* window = browser()->window(); | 268 BrowserWindow* window = browser()->window(); |
| 269 ASSERT_TRUE(window); | 269 ASSERT_TRUE(window); |
| 270 gfx::NativeWindow native_window = window->GetNativeWindow(); | 270 gfx::NativeWindow native_window = window->GetNativeWindow(); |
| 271 ASSERT_TRUE(native_window); | 271 ASSERT_TRUE(native_window); |
| 272 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, | 272 bool key_sent = ui_controls::SendKeyPress(native_window, ui::VKEY_ESCAPE, |
| 273 false, false, false, false); | 273 false, false, false, false); |
| 274 EXPECT_TRUE(key_sent); | 274 EXPECT_TRUE(key_sent); |
| 275 if (key_sent) | 275 if (key_sent) |
| 276 tab_closed_observer.Wait(); | 276 tab_closed_observer.Wait(); |
| 277 } | 277 } |
| OLD | NEW |