OLD | NEW |
1 // Copyright 2014 The Chromium Authors. All rights reserved. | 1 // Copyright 2014 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 "ui/views/controls/webview/webview.h" | 5 #include "ui/views/controls/webview/webview.h" |
6 | 6 |
| 7 #include <stdint.h> |
| 8 |
| 9 #include "base/macros.h" |
7 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
8 #include "content/public/browser/web_contents.h" | 11 #include "content/public/browser/web_contents.h" |
9 #include "content/public/browser/web_contents_observer.h" | 12 #include "content/public/browser/web_contents_observer.h" |
10 #include "content/public/test/test_browser_context.h" | 13 #include "content/public/test/test_browser_context.h" |
11 #include "content/public/test/test_browser_thread.h" | 14 #include "content/public/test/test_browser_thread.h" |
12 #include "content/public/test/web_contents_tester.h" | 15 #include "content/public/test/web_contents_tester.h" |
13 #include "content/test/test_content_browser_client.h" | 16 #include "content/test/test_content_browser_client.h" |
14 #include "ui/aura/window.h" | 17 #include "ui/aura/window.h" |
15 #include "ui/events/event.h" | 18 #include "ui/events/event.h" |
16 #include "ui/events/event_utils.h" | 19 #include "ui/events/event_utils.h" |
(...skipping 62 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 | 82 |
80 int shown_count() const { return shown_count_; } | 83 int shown_count() const { return shown_count_; } |
81 | 84 |
82 int hidden_count() const { return hidden_count_; } | 85 int hidden_count() const { return hidden_count_; } |
83 | 86 |
84 bool valid_root_while_shown() const { return valid_root_while_shown_; } | 87 bool valid_root_while_shown() const { return valid_root_while_shown_; } |
85 | 88 |
86 private: | 89 private: |
87 content::WebContents* web_contents_; | 90 content::WebContents* web_contents_; |
88 bool was_shown_; | 91 bool was_shown_; |
89 int32 shown_count_; | 92 int32_t shown_count_; |
90 int32 hidden_count_; | 93 int32_t hidden_count_; |
91 // Set to true if the view containing the webcontents has a valid root window. | 94 // Set to true if the view containing the webcontents has a valid root window. |
92 bool valid_root_while_shown_; | 95 bool valid_root_while_shown_; |
93 | 96 |
94 DISALLOW_COPY_AND_ASSIGN(WebViewTestWebContentsObserver); | 97 DISALLOW_COPY_AND_ASSIGN(WebViewTestWebContentsObserver); |
95 }; | 98 }; |
96 | 99 |
97 // Fakes the fullscreen browser state reported to WebContents and WebView. | 100 // Fakes the fullscreen browser state reported to WebContents and WebView. |
98 class WebViewTestWebContentsDelegate : public content::WebContentsDelegate { | 101 class WebViewTestWebContentsDelegate : public content::WebContentsDelegate { |
99 public: | 102 public: |
100 WebViewTestWebContentsDelegate() : is_fullscreened_(false) {} | 103 WebViewTestWebContentsDelegate() : is_fullscreened_(false) {} |
(...skipping 327 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
428 gfx::Point(), // Immaterial. | 431 gfx::Point(), // Immaterial. |
429 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); | 432 ui::EventTimeForNow(), ui::EF_LEFT_MOUSE_BUTTON, 0); |
430 EXPECT_FALSE(static_cast<views::View*>(web_view())-> | 433 EXPECT_FALSE(static_cast<views::View*>(web_view())-> |
431 OnMousePressed(click_inside_holder)); | 434 OnMousePressed(click_inside_holder)); |
432 EXPECT_FALSE(web_view()->HasFocus()); | 435 EXPECT_FALSE(web_view()->HasFocus()); |
433 EXPECT_FALSE(holder()->HasFocus()); | 436 EXPECT_FALSE(holder()->HasFocus()); |
434 EXPECT_TRUE(something_to_focus->HasFocus()); | 437 EXPECT_TRUE(something_to_focus->HasFocus()); |
435 } | 438 } |
436 | 439 |
437 } // namespace views | 440 } // namespace views |
OLD | NEW |