| 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/profiles/profile.h" | 5 #include "chrome/browser/profiles/profile.h" |
| 6 #include "chrome/browser/ui/browser.h" | 6 #include "chrome/browser/ui/browser.h" |
| 7 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" | 7 #include "chrome/browser/ui/intents/web_intent_inline_disposition_delegate.h" |
| 8 #include "chrome/browser/ui/intents/web_intent_picker.h" | 8 #include "chrome/browser/ui/intents/web_intent_picker.h" |
| 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" | 9 #include "chrome/browser/ui/tab_contents/tab_contents.h" |
| 10 #include "chrome/test/base/browser_with_test_window_test.h" | 10 #include "chrome/test/base/browser_with_test_window_test.h" |
| 11 #include "chrome/test/base/testing_profile.h" | 11 #include "chrome/test/base/testing_profile.h" |
| 12 #include "content/public/browser/web_contents.h" | 12 #include "content/public/browser/web_contents.h" |
| 13 #include "content/public/common/url_constants.h" | 13 #include "content/public/common/url_constants.h" |
| 14 #include "testing/gtest/include/gtest/gtest.h" | 14 #include "testing/gtest/include/gtest/gtest.h" |
| 15 | 15 |
| 16 class WebIntentPickerMock : public WebIntentPicker { | 16 class WebIntentPickerMock : public WebIntentPicker { |
| 17 public: | 17 public: |
| 18 virtual void Close() OVERRIDE {} | 18 virtual void Close() OVERRIDE {} |
| 19 virtual void SetActionString(const string16& action) OVERRIDE {} | 19 virtual void SetActionString(const string16& action) OVERRIDE {} |
| 20 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE {} | 20 virtual void OnExtensionInstallSuccess(const std::string& id) OVERRIDE {} |
| 21 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE {} | 21 virtual void OnExtensionInstallFailure(const std::string& id) OVERRIDE {} |
| 22 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE {} | 22 virtual void OnInlineDispositionAutoResize(const gfx::Size& size) OVERRIDE {} |
| 23 virtual void OnPendingAsyncCompleted() OVERRIDE {} | 23 virtual void OnPendingAsyncCompleted() OVERRIDE {} |
| 24 | 24 virtual void InvalidateDelegate() OVERRIDE {} |
| 25 }; | 25 }; |
| 26 | 26 |
| 27 class WebIntentInlineDispositionBrowserTest | 27 class WebIntentInlineDispositionBrowserTest |
| 28 : public BrowserWithTestWindowTest { | 28 : public BrowserWithTestWindowTest { |
| 29 public: | 29 public: |
| 30 virtual void SetUp() { | 30 virtual void SetUp() { |
| 31 BrowserWithTestWindowTest::SetUp(); | 31 BrowserWithTestWindowTest::SetUp(); |
| 32 | 32 |
| 33 content::WebContents* contents = content::WebContents::Create( | 33 content::WebContents* contents = content::WebContents::Create( |
| 34 browser()->profile(), NULL, MSG_ROUTING_NONE, NULL); | 34 browser()->profile(), NULL, MSG_ROUTING_NONE, NULL); |
| (...skipping 14 matching lines...) Expand all Loading... |
| 49 TEST_F(WebIntentInlineDispositionBrowserTest, OpenURLFromTabTest) { | 49 TEST_F(WebIntentInlineDispositionBrowserTest, OpenURLFromTabTest) { |
| 50 content::WebContents* source = delegate_->OpenURLFromTab( | 50 content::WebContents* source = delegate_->OpenURLFromTab( |
| 51 tab_contents_->web_contents(), | 51 tab_contents_->web_contents(), |
| 52 content::OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), | 52 content::OpenURLParams(GURL(chrome::kAboutBlankURL), content::Referrer(), |
| 53 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); | 53 NEW_FOREGROUND_TAB, content::PAGE_TRANSITION_LINK, false)); |
| 54 | 54 |
| 55 // Ensure OpenURLFromTab loaded about::blank in |web_contents_|. | 55 // Ensure OpenURLFromTab loaded about::blank in |web_contents_|. |
| 56 ASSERT_EQ(tab_contents_->web_contents(), source); | 56 ASSERT_EQ(tab_contents_->web_contents(), source); |
| 57 EXPECT_EQ(GURL(chrome::kAboutBlankURL).spec(), source->GetURL().spec()); | 57 EXPECT_EQ(GURL(chrome::kAboutBlankURL).spec(), source->GetURL().spec()); |
| 58 } | 58 } |
| OLD | NEW |