| 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 "chrome/browser/ui/webui/web_dialog_web_contents_delegate.h" | 5 #include "ui/web_dialogs/web_dialog_web_contents_delegate.h" |
| 6 | 6 |
| 7 #include <vector> | 7 #include <vector> |
| 8 | 8 |
| 9 #include "base/logging.h" | 9 #include "base/logging.h" |
| 10 #include "base/memory/scoped_ptr.h" | 10 #include "base/memory/scoped_ptr.h" |
| 11 #include "chrome/browser/history/history_types.h" | 11 #include "chrome/browser/history/history_types.h" |
| 12 #include "chrome/browser/ui/browser.h" | 12 #include "chrome/browser/ui/browser.h" |
| 13 #include "chrome/browser/ui/browser_list.h" | 13 #include "chrome/browser/ui/browser_list.h" |
| 14 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" | 14 #include "chrome/browser/ui/webui/chrome_web_contents_handler.h" |
| 15 #include "chrome/common/url_constants.h" | 15 #include "chrome/common/url_constants.h" |
| 16 #include "chrome/test/base/browser_with_test_window_test.h" | 16 #include "chrome/test/base/browser_with_test_window_test.h" |
| 17 #include "chrome/test/base/test_browser_window.h" | 17 #include "chrome/test/base/test_browser_window.h" |
| 18 #include "chrome/test/base/testing_profile.h" | 18 #include "chrome/test/base/testing_profile.h" |
| 19 #include "content/public/browser/web_contents.h" | 19 #include "content/public/browser/web_contents.h" |
| 20 #include "content/public/test/web_contents_tester.h" | 20 #include "content/public/test/web_contents_tester.h" |
| 21 #include "googleurl/src/gurl.h" | 21 #include "googleurl/src/gurl.h" |
| 22 #include "testing/gmock/include/gmock/gmock.h" | 22 #include "testing/gmock/include/gmock/gmock.h" |
| 23 #include "testing/gtest/include/gtest/gtest.h" | 23 #include "testing/gtest/include/gtest/gtest.h" |
| 24 #include "ui/gfx/rect.h" | 24 #include "ui/gfx/rect.h" |
| 25 | 25 |
| 26 using content::OpenURLParams; | 26 using content::OpenURLParams; |
| 27 using content::Referrer; | 27 using content::Referrer; |
| 28 using content::BrowserContext; | 28 using content::BrowserContext; |
| 29 using content::WebContents; | 29 using content::WebContents; |
| 30 using content::WebContentsTester; | 30 using content::WebContentsTester; |
| 31 using ui::WebDialogWebContentsDelegate; |
| 31 | 32 |
| 32 namespace { | 33 namespace { |
| 33 | 34 |
| 34 class TestWebContentsDelegate : public WebDialogWebContentsDelegate { | 35 class TestWebContentsDelegate : public WebDialogWebContentsDelegate { |
| 35 public: | 36 public: |
| 36 explicit TestWebContentsDelegate(content::BrowserContext* context) | 37 explicit TestWebContentsDelegate(content::BrowserContext* context) |
| 37 : WebDialogWebContentsDelegate(context, new ChromeWebContentsHandler) { | 38 : WebDialogWebContentsDelegate(context, new ChromeWebContentsHandler) { |
| 38 } | 39 } |
| 39 virtual ~TestWebContentsDelegate() { | 40 virtual ~TestWebContentsDelegate() { |
| 40 } | 41 } |
| (...skipping 64 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 105 test_web_contents_delegate_->OpenURLFromTab( | 106 test_web_contents_delegate_->OpenURLFromTab( |
| 106 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), Referrer(), | 107 NULL, OpenURLParams(GURL(chrome::kAboutBlankURL), Referrer(), |
| 107 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 108 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
| 108 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, | 109 test_web_contents_delegate_->AddNewContents(NULL, NULL, NEW_FOREGROUND_TAB, |
| 109 gfx::Rect(), false); | 110 gfx::Rect(), false); |
| 110 EXPECT_EQ(0, browser()->tab_count()); | 111 EXPECT_EQ(0, browser()->tab_count()); |
| 111 EXPECT_EQ(1U, BrowserList::size()); | 112 EXPECT_EQ(1U, BrowserList::size()); |
| 112 } | 113 } |
| 113 | 114 |
| 114 } // namespace | 115 } // namespace |
| OLD | NEW |