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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/memory/singleton.h" | 6 #include "base/memory/singleton.h" |
7 #include "base/run_loop.h" | 7 #include "base/run_loop.h" |
8 #include "base/string_util.h" | 8 #include "base/string_util.h" |
9 #include "base/strings/string_split.h" | 9 #include "base/strings/string_split.h" |
10 #include "base/test/test_timeouts.h" | 10 #include "base/test/test_timeouts.h" |
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
106 | 106 |
107 namespace content { | 107 namespace content { |
108 | 108 |
109 // Test factory for creating test instances of BrowserPluginEmbedder and | 109 // Test factory for creating test instances of BrowserPluginEmbedder and |
110 // BrowserPluginGuest. | 110 // BrowserPluginGuest. |
111 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { | 111 class TestBrowserPluginHostFactory : public BrowserPluginHostFactory { |
112 public: | 112 public: |
113 virtual BrowserPluginGuestManager* | 113 virtual BrowserPluginGuestManager* |
114 CreateBrowserPluginGuestManager() OVERRIDE { | 114 CreateBrowserPluginGuestManager() OVERRIDE { |
115 guest_manager_instance_count_++; | 115 guest_manager_instance_count_++; |
116 if (message_loop_runner_) | 116 if (message_loop_runner_.get()) |
117 message_loop_runner_->Quit(); | 117 message_loop_runner_->Quit(); |
118 return new TestBrowserPluginGuestManager(); | 118 return new TestBrowserPluginGuestManager(); |
119 } | 119 } |
120 | 120 |
121 virtual BrowserPluginGuest* CreateBrowserPluginGuest( | 121 virtual BrowserPluginGuest* CreateBrowserPluginGuest( |
122 int instance_id, | 122 int instance_id, |
123 WebContentsImpl* web_contents) OVERRIDE { | 123 WebContentsImpl* web_contents) OVERRIDE { |
124 return new TestBrowserPluginGuest(instance_id, web_contents); | 124 return new TestBrowserPluginGuest(instance_id, web_contents); |
125 } | 125 } |
126 | 126 |
(...skipping 83 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
210 } | 210 } |
211 | 211 |
212 void ResetState() { | 212 void ResetState() { |
213 message_received_ = false; | 213 message_received_ = false; |
214 } | 214 } |
215 | 215 |
216 // IPC::Listener implementation. | 216 // IPC::Listener implementation. |
217 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { | 217 virtual bool OnMessageReceived(const IPC::Message& message) OVERRIDE { |
218 if (message.type() == message_id_) { | 218 if (message.type() == message_id_) { |
219 message_received_ = true; | 219 message_received_ = true; |
220 if (message_loop_runner_) | 220 if (message_loop_runner_.get()) |
221 message_loop_runner_->Quit(); | 221 message_loop_runner_->Quit(); |
222 } | 222 } |
223 return false; | 223 return false; |
224 } | 224 } |
225 | 225 |
226 private: | 226 private: |
227 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 227 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
228 uint32 message_id_; | 228 uint32 message_id_; |
229 bool message_received_; | 229 bool message_received_; |
230 | 230 |
(...skipping 1227 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1458 const string16 expected_title = ASCIIToUTF16("AutoSize(640, 480)"); | 1458 const string16 expected_title = ASCIIToUTF16("AutoSize(640, 480)"); |
1459 content::TitleWatcher title_watcher(test_embedder()->web_contents(), | 1459 content::TitleWatcher title_watcher(test_embedder()->web_contents(), |
1460 expected_title); | 1460 expected_title); |
1461 RemoveAttributes(rvh, "maxwidth"); | 1461 RemoveAttributes(rvh, "maxwidth"); |
1462 string16 actual_title = title_watcher.WaitAndGetTitle(); | 1462 string16 actual_title = title_watcher.WaitAndGetTitle(); |
1463 EXPECT_EQ(expected_title, actual_title); | 1463 EXPECT_EQ(expected_title, actual_title); |
1464 } | 1464 } |
1465 } | 1465 } |
1466 | 1466 |
1467 } // namespace content | 1467 } // namespace content |
OLD | NEW |