| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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 "apps/app_window.h" | 5 #include "apps/app_window.h" |
| 6 #include "apps/app_window_registry.h" | 6 #include "apps/app_window_registry.h" |
| 7 #include "base/strings/stringprintf.h" | 7 #include "base/strings/stringprintf.h" |
| 8 #include "base/strings/utf_string_conversions.h" | 8 #include "base/strings/utf_string_conversions.h" |
| 9 #include "chrome/app/chrome_command_ids.h" | 9 #include "chrome/app/chrome_command_ids.h" |
| 10 #include "chrome/browser/apps/app_browsertest_util.h" | 10 #include "chrome/browser/apps/app_browsertest_util.h" |
| (...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 50 return web_contents_; | 50 return web_contents_; |
| 51 } | 51 } |
| 52 | 52 |
| 53 private: | 53 private: |
| 54 // GuestViewManager override: | 54 // GuestViewManager override: |
| 55 virtual void AddGuest(int guest_instance_id, | 55 virtual void AddGuest(int guest_instance_id, |
| 56 content::WebContents* guest_web_contents) OVERRIDE{ | 56 content::WebContents* guest_web_contents) OVERRIDE{ |
| 57 GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); | 57 GuestViewManager::AddGuest(guest_instance_id, guest_web_contents); |
| 58 web_contents_ = guest_web_contents; | 58 web_contents_ = guest_web_contents; |
| 59 | 59 |
| 60 if (message_loop_runner_) | 60 if (message_loop_runner_.get()) |
| 61 message_loop_runner_->Quit(); | 61 message_loop_runner_->Quit(); |
| 62 } | 62 } |
| 63 | 63 |
| 64 content::WebContents* web_contents_; | 64 content::WebContents* web_contents_; |
| 65 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; | 65 scoped_refptr<content::MessageLoopRunner> message_loop_runner_; |
| 66 }; | 66 }; |
| 67 | 67 |
| 68 // Test factory for creating test instances of GuestViewManager. | 68 // Test factory for creating test instances of GuestViewManager. |
| 69 class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { | 69 class TestGuestViewManagerFactory : public extensions::GuestViewManagerFactory { |
| 70 public: | 70 public: |
| (...skipping 284 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 355 gfx::Rect popup_bounds = | 355 gfx::Rect popup_bounds = |
| 356 last_render_widget_host_->GetView()->GetViewBounds(); | 356 last_render_widget_host_->GetView()->GetViewBounds(); |
| 357 if (!popup_bounds.size().IsEmpty()) | 357 if (!popup_bounds.size().IsEmpty()) |
| 358 needs_to_schedule_wait = false; | 358 needs_to_schedule_wait = false; |
| 359 } | 359 } |
| 360 | 360 |
| 361 if (needs_to_schedule_wait) { | 361 if (needs_to_schedule_wait) { |
| 362 ScheduleWait(); | 362 ScheduleWait(); |
| 363 } else { | 363 } else { |
| 364 // We are done. | 364 // We are done. |
| 365 if (message_loop_) | 365 if (message_loop_.get()) |
| 366 message_loop_->Quit(); | 366 message_loop_->Quit(); |
| 367 } | 367 } |
| 368 | 368 |
| 369 if (!message_loop_) { | 369 if (!message_loop_.get()) { |
| 370 message_loop_ = new content::MessageLoopRunner; | 370 message_loop_ = new content::MessageLoopRunner; |
| 371 message_loop_->Run(); | 371 message_loop_->Run(); |
| 372 } | 372 } |
| 373 } | 373 } |
| 374 | 374 |
| 375 void Init() { initial_widget_count_ = CountWidgets(); } | 375 void Init() { initial_widget_count_ = CountWidgets(); } |
| 376 | 376 |
| 377 // Returns the last widget created. | 377 // Returns the last widget created. |
| 378 content::RenderWidgetHost* last_render_widget_host() { | 378 content::RenderWidgetHost* last_render_widget_host() { |
| 379 return last_render_widget_host_; | 379 return last_render_widget_host_; |
| (...skipping 726 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 1106 | 1106 |
| 1107 // Now verify that the selection text propagates properly to RWHV. | 1107 // Now verify that the selection text propagates properly to RWHV. |
| 1108 content::RenderWidgetHostView* guest_rwhv = | 1108 content::RenderWidgetHostView* guest_rwhv = |
| 1109 guest_web_contents()->GetRenderWidgetHostView(); | 1109 guest_web_contents()->GetRenderWidgetHostView(); |
| 1110 ASSERT_TRUE(guest_rwhv); | 1110 ASSERT_TRUE(guest_rwhv); |
| 1111 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); | 1111 std::string selected_text = base::UTF16ToUTF8(guest_rwhv->GetSelectedText()); |
| 1112 ASSERT_TRUE(selected_text.size() >= 10u); | 1112 ASSERT_TRUE(selected_text.size() >= 10u); |
| 1113 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); | 1113 ASSERT_EQ("AAAAAAAAAA", selected_text.substr(0, 10)); |
| 1114 } | 1114 } |
| 1115 #endif | 1115 #endif |
| OLD | NEW |