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 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 5 #ifndef CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 6 #define CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <string> | 9 #include <string> |
10 #include <vector> | 10 #include <vector> |
(...skipping 362 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
373 scoped_refptr<MessageLoopRunner> message_loop_runner_; | 373 scoped_refptr<MessageLoopRunner> message_loop_runner_; |
374 | 374 |
375 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); | 375 DISALLOW_COPY_AND_ASSIGN(DOMMessageQueue); |
376 }; | 376 }; |
377 | 377 |
378 // Used to wait for a new WebContents to be created. Instantiate this object | 378 // Used to wait for a new WebContents to be created. Instantiate this object |
379 // before the operation that will create the window. | 379 // before the operation that will create the window. |
380 class WebContentsAddedObserver { | 380 class WebContentsAddedObserver { |
381 public: | 381 public: |
382 WebContentsAddedObserver(); | 382 WebContentsAddedObserver(); |
383 ~WebContentsAddedObserver(); | 383 virtual ~WebContentsAddedObserver(); |
384 | 384 |
385 // Will run a message loop to wait for the new window if it hasn't been | 385 // Will run a message loop to wait for the new window if it hasn't been |
386 // created since the constructor | 386 // created since the constructor |
387 WebContents* GetWebContents(); | 387 WebContents* GetWebContents(); |
388 | 388 |
389 // Will tell whether RenderViewCreated Callback has invoked | 389 // Will tell whether RenderViewCreated Callback has invoked |
390 bool RenderViewCreatedCalled(); | 390 bool RenderViewCreatedCalled(); |
391 | 391 |
| 392 protected: |
| 393 virtual void WebContentsCreated(WebContents* web_contents); |
| 394 |
392 private: | 395 private: |
393 class RenderViewCreatedObserver; | 396 class RenderViewCreatedObserver; |
394 | 397 |
395 void WebContentsCreated(WebContents* web_contents); | |
396 | |
397 // Callback to WebContentCreated(). Cached so that we can unregister it. | 398 // Callback to WebContentCreated(). Cached so that we can unregister it. |
398 base::Callback<void(WebContents*)> web_contents_created_callback_; | 399 base::Callback<void(WebContents*)> web_contents_created_callback_; |
399 | 400 |
400 WebContents* web_contents_; | 401 WebContents* web_contents_; |
401 scoped_ptr<RenderViewCreatedObserver> child_observer_; | 402 scoped_ptr<RenderViewCreatedObserver> child_observer_; |
402 scoped_refptr<MessageLoopRunner> runner_; | 403 scoped_refptr<MessageLoopRunner> runner_; |
403 | 404 |
404 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); | 405 DISALLOW_COPY_AND_ASSIGN(WebContentsAddedObserver); |
405 }; | 406 }; |
406 | 407 |
407 } // namespace content | 408 } // namespace content |
408 | 409 |
409 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ | 410 #endif // CONTENT_PUBLIC_TEST_BROWSER_TEST_UTILS_H_ |
OLD | NEW |