OLD | NEW |
1 // Copyright 2015 The Chromium Authors. All rights reserved. | 1 // Copyright 2015 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 "content/browser/frame_host/interstitial_page_impl.h" | 5 #include "content/browser/frame_host/interstitial_page_impl.h" |
6 | 6 |
7 #include "base/macros.h" | 7 #include "base/macros.h" |
8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
9 #include "base/synchronization/waitable_event.h" | 9 #include "base/synchronization/waitable_event.h" |
10 #include "build/build_config.h" | 10 #include "build/build_config.h" |
(...skipping 297 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
308 } | 308 } |
309 | 309 |
310 void PerformSelectAll() { | 310 void PerformSelectAll() { |
311 RenderFrameHostImpl* rfh = | 311 RenderFrameHostImpl* rfh = |
312 static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame()); | 312 static_cast<RenderFrameHostImpl*>(interstitial_->GetMainFrame()); |
313 rfh->GetRenderWidgetHost()->delegate()->SelectAll(); | 313 rfh->GetRenderWidgetHost()->delegate()->SelectAll(); |
314 } | 314 } |
315 | 315 |
316 private: | 316 private: |
317 void RunTaskOnIOThreadAndWait(const base::Closure& task) { | 317 void RunTaskOnIOThreadAndWait(const base::Closure& task) { |
318 base::WaitableEvent completion(false, false); | 318 base::WaitableEvent completion( |
| 319 base::WaitableEvent::ResetPolicy::AUTOMATIC, |
| 320 base::WaitableEvent::InitialState::NOT_SIGNALED); |
319 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, | 321 BrowserThread::PostTask(BrowserThread::IO, FROM_HERE, |
320 base::Bind(&InterstitialPageImplTest::RunTask, this, | 322 base::Bind(&InterstitialPageImplTest::RunTask, this, |
321 task, &completion)); | 323 task, &completion)); |
322 completion.Wait(); | 324 completion.Wait(); |
323 } | 325 } |
324 | 326 |
325 void RunTask(const base::Closure& task, base::WaitableEvent* completion) { | 327 void RunTask(const base::Closure& task, base::WaitableEvent* completion) { |
326 task.Run(); | 328 task.Run(); |
327 completion->Signal(); | 329 completion->Signal(); |
328 } | 330 } |
(...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
393 EXPECT_EQ(std::string(), input_text); | 395 EXPECT_EQ(std::string(), input_text); |
394 | 396 |
395 PerformSelectAll(); | 397 PerformSelectAll(); |
396 ASSERT_TRUE(GetSelection(&input_text)); | 398 ASSERT_TRUE(GetSelection(&input_text)); |
397 EXPECT_EQ("original body text", input_text); | 399 EXPECT_EQ("original body text", input_text); |
398 | 400 |
399 TearDownInterstitialPage(); | 401 TearDownInterstitialPage(); |
400 } | 402 } |
401 | 403 |
402 } // namespace content | 404 } // namespace content |
OLD | NEW |