| OLD | NEW |
| 1 // Copyright 2013 The Chromium Authors. All rights reserved. | 1 // Copyright 2013 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/extensions/extension_view_host_factory.h" | 5 #include "chrome/browser/extensions/extension_view_host_factory.h" |
| 6 | 6 |
| 7 #include "chrome/browser/extensions/extension_browsertest.h" | 7 #include "chrome/browser/extensions/extension_browsertest.h" |
| 8 #include "chrome/browser/extensions/extension_view_host.h" | 8 #include "chrome/browser/extensions/extension_view_host.h" |
| 9 #include "chrome/browser/profiles/profile.h" | 9 #include "chrome/browser/profiles/profile.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 18 matching lines...) Expand all Loading... |
| 29 // Popup hosts are created with the correct type and profile. | 29 // Popup hosts are created with the correct type and profile. |
| 30 scoped_ptr<ExtensionViewHost> host( | 30 scoped_ptr<ExtensionViewHost> host( |
| 31 ExtensionViewHostFactory::CreatePopupHost(extension->url(), browser())); | 31 ExtensionViewHostFactory::CreatePopupHost(extension->url(), browser())); |
| 32 EXPECT_EQ(extension.get(), host->extension()); | 32 EXPECT_EQ(extension.get(), host->extension()); |
| 33 EXPECT_EQ(browser_context, host->browser_context()); | 33 EXPECT_EQ(browser_context, host->browser_context()); |
| 34 EXPECT_EQ(VIEW_TYPE_EXTENSION_POPUP, host->extension_host_type()); | 34 EXPECT_EQ(VIEW_TYPE_EXTENSION_POPUP, host->extension_host_type()); |
| 35 EXPECT_TRUE(host->view()); | 35 EXPECT_TRUE(host->view()); |
| 36 } | 36 } |
| 37 | 37 |
| 38 { | 38 { |
| 39 // Infobar hosts are created with the correct type and profile. | |
| 40 scoped_ptr<ExtensionViewHost> host( | |
| 41 ExtensionViewHostFactory::CreateInfobarHost(extension->url(), | |
| 42 browser())); | |
| 43 EXPECT_EQ(extension.get(), host->extension()); | |
| 44 EXPECT_EQ(browser_context, host->browser_context()); | |
| 45 EXPECT_EQ(VIEW_TYPE_EXTENSION_INFOBAR, host->extension_host_type()); | |
| 46 EXPECT_TRUE(host->view()); | |
| 47 } | |
| 48 | |
| 49 { | |
| 50 // Dialog hosts are created with the correct type and profile. | 39 // Dialog hosts are created with the correct type and profile. |
| 51 scoped_ptr<ExtensionViewHost> host( | 40 scoped_ptr<ExtensionViewHost> host( |
| 52 ExtensionViewHostFactory::CreateDialogHost(extension->url(), | 41 ExtensionViewHostFactory::CreateDialogHost(extension->url(), |
| 53 browser()->profile())); | 42 browser()->profile())); |
| 54 EXPECT_EQ(extension.get(), host->extension()); | 43 EXPECT_EQ(extension.get(), host->extension()); |
| 55 EXPECT_EQ(browser_context, host->browser_context()); | 44 EXPECT_EQ(browser_context, host->browser_context()); |
| 56 EXPECT_EQ(VIEW_TYPE_EXTENSION_DIALOG, host->extension_host_type()); | 45 EXPECT_EQ(VIEW_TYPE_EXTENSION_DIALOG, host->extension_host_type()); |
| 57 EXPECT_TRUE(host->view()); | 46 EXPECT_TRUE(host->view()); |
| 58 } | 47 } |
| 59 } | 48 } |
| (...skipping 32 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 92 // The ExtensionHost for a split-mode extension is associated with the | 81 // The ExtensionHost for a split-mode extension is associated with the |
| 93 // incognito profile. | 82 // incognito profile. |
| 94 scoped_ptr<ExtensionHost> split_mode_host( | 83 scoped_ptr<ExtensionHost> split_mode_host( |
| 95 ExtensionViewHostFactory::CreatePopupHost( | 84 ExtensionViewHostFactory::CreatePopupHost( |
| 96 split_mode_extension->url(), incognito_browser)); | 85 split_mode_extension->url(), incognito_browser)); |
| 97 content::BrowserContext* incognito_context = incognito_browser->profile(); | 86 content::BrowserContext* incognito_context = incognito_browser->profile(); |
| 98 EXPECT_EQ(incognito_context, split_mode_host->browser_context()); | 87 EXPECT_EQ(incognito_context, split_mode_host->browser_context()); |
| 99 } | 88 } |
| 100 | 89 |
| 101 } // namespace extensions | 90 } // namespace extensions |
| OLD | NEW |