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 "ui/web_dialogs/web_dialog_web_contents_delegate.h" | 5 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" |
6 | 6 |
| 7 #include <memory> |
7 #include <vector> | 8 #include <vector> |
8 | 9 |
9 #include "base/logging.h" | 10 #include "base/logging.h" |
10 #include "base/macros.h" | 11 #include "base/macros.h" |
11 #include "base/memory/scoped_ptr.h" | |
12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
13 #include "chrome/browser/ui/browser_finder.h" | 13 #include "chrome/browser/ui/browser_finder.h" |
14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" |
15 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 15 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
16 #include "chrome/common/url_constants.h" | 16 #include "chrome/common/url_constants.h" |
17 #include "chrome/test/base/browser_with_test_window_test.h" | 17 #include "chrome/test/base/browser_with_test_window_test.h" |
18 #include "chrome/test/base/test_browser_window.h" | 18 #include "chrome/test/base/test_browser_window.h" |
19 #include "chrome/test/base/testing_profile.h" | 19 #include "chrome/test/base/testing_profile.h" |
20 #include "components/history/core/browser/history_types.h" | 20 #include "components/history/core/browser/history_types.h" |
21 #include "content/public/browser/web_contents.h" | 21 #include "content/public/browser/web_contents.h" |
(...skipping 29 matching lines...) Expand all Loading... |
51 BrowserWithTestWindowTest::SetUp(); | 51 BrowserWithTestWindowTest::SetUp(); |
52 test_web_contents_delegate_.reset(new TestWebContentsDelegate(profile())); | 52 test_web_contents_delegate_.reset(new TestWebContentsDelegate(profile())); |
53 } | 53 } |
54 | 54 |
55 void TearDown() override { | 55 void TearDown() override { |
56 test_web_contents_delegate_.reset(NULL); | 56 test_web_contents_delegate_.reset(NULL); |
57 BrowserWithTestWindowTest::TearDown(); | 57 BrowserWithTestWindowTest::TearDown(); |
58 } | 58 } |
59 | 59 |
60 protected: | 60 protected: |
61 scoped_ptr<TestWebContentsDelegate> test_web_contents_delegate_; | 61 std::unique_ptr<TestWebContentsDelegate> test_web_contents_delegate_; |
62 }; | 62 }; |
63 | 63 |
64 TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) { | 64 TEST_F(WebDialogWebContentsDelegateTest, DoNothingMethodsTest) { |
65 // None of the following calls should do anything. | 65 // None of the following calls should do anything. |
66 EXPECT_TRUE(test_web_contents_delegate_->IsPopupOrPanel(NULL)); | 66 EXPECT_TRUE(test_web_contents_delegate_->IsPopupOrPanel(NULL)); |
67 history::HistoryAddPageArgs should_add_args( | 67 history::HistoryAddPageArgs should_add_args( |
68 GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(), | 68 GURL(), base::Time::Now(), 0, 0, GURL(), history::RedirectList(), |
69 ui::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false); | 69 ui::PAGE_TRANSITION_TYPED, history::SOURCE_SYNCED, false); |
70 test_web_contents_delegate_->NavigationStateChanged( | 70 test_web_contents_delegate_->NavigationStateChanged( |
71 NULL, content::InvalidateTypes(0)); | 71 NULL, content::InvalidateTypes(0)); |
(...skipping 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
113 NEW_FOREGROUND_TAB, | 113 NEW_FOREGROUND_TAB, |
114 ui::PAGE_TRANSITION_LINK, | 114 ui::PAGE_TRANSITION_LINK, |
115 false)); | 115 false)); |
116 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, | 116 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, |
117 gfx::Rect(), false, NULL); | 117 gfx::Rect(), false, NULL); |
118 EXPECT_EQ(0, browser()->tab_strip_model()->count()); | 118 EXPECT_EQ(0, browser()->tab_strip_model()->count()); |
119 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); | 119 EXPECT_EQ(1U, chrome::GetTotalBrowserCount()); |
120 } | 120 } |
121 | 121 |
122 } // namespace | 122 } // namespace |
OLD | NEW |