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 <vector> | 5 #include <vector> |
6 | 6 |
7 #include "base/file_path.h" | 7 #include "base/file_path.h" |
8 #include "base/time.h" | 8 #include "base/time.h" |
9 #include "chrome/browser/ui/browser.h" | 9 #include "chrome/browser/ui/browser.h" |
| 10 #include "chrome/browser/ui/browser_tabstrip.h" |
10 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" | 11 #include "chrome/browser/ui/views/ash/launcher/browser_launcher_item_controller.
h" |
11 #include "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h" | 12 #include "chrome/browser/ui/views/ash/launcher/launcher_favicon_loader.h" |
12 #include "chrome/browser/ui/views/frame/browser_view.h" | 13 #include "chrome/browser/ui/views/frame/browser_view.h" |
13 #include "chrome/common/favicon_url.h" | 14 #include "chrome/common/favicon_url.h" |
14 #include "chrome/common/icon_messages.h" | 15 #include "chrome/common/icon_messages.h" |
15 #include "chrome/test/base/in_process_browser_test.h" | 16 #include "chrome/test/base/in_process_browser_test.h" |
16 #include "chrome/test/base/ui_test_utils.h" | 17 #include "chrome/test/base/ui_test_utils.h" |
17 #include "content/public/browser/web_contents.h" | 18 #include "content/public/browser/web_contents.h" |
18 #include "content/public/browser/web_contents_delegate.h" | 19 #include "content/public/browser/web_contents_delegate.h" |
19 #include "net/test/test_server.h" | 20 #include "net/test/test_server.h" |
(...skipping 59 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
79 void CreatePanelBrowser(const char* url, Browser** result) { | 80 void CreatePanelBrowser(const char* url, Browser** result) { |
80 Browser* panel_browser = Browser::CreateWithParams( | 81 Browser* panel_browser = Browser::CreateWithParams( |
81 Browser::CreateParams::CreateForApp( | 82 Browser::CreateParams::CreateForApp( |
82 Browser::TYPE_PANEL, "Test Panel", gfx::Rect(), | 83 Browser::TYPE_PANEL, "Test Panel", gfx::Rect(), |
83 browser()->profile())); | 84 browser()->profile())); |
84 EXPECT_TRUE(panel_browser->is_type_panel()); | 85 EXPECT_TRUE(panel_browser->is_type_panel()); |
85 ASSERT_EQ(static_cast<void*>(NULL), contents_observer_.get()); | 86 ASSERT_EQ(static_cast<void*>(NULL), contents_observer_.get()); |
86 // Load initial tab contents before setting the observer. | 87 // Load initial tab contents before setting the observer. |
87 ui_test_utils::NavigateToURL(panel_browser, GURL()); | 88 ui_test_utils::NavigateToURL(panel_browser, GURL()); |
88 contents_observer_.reset( | 89 contents_observer_.reset( |
89 new ContentsObserver(panel_browser->GetWebContentsAt(0))); | 90 new ContentsObserver(chrome::GetWebContentsAt(panel_browser, 0))); |
90 NavigateTo(panel_browser, url); | 91 NavigateTo(panel_browser, url); |
91 *result = panel_browser; | 92 *result = panel_browser; |
92 } | 93 } |
93 | 94 |
94 LauncherFaviconLoader* GetFaviconLoader(Browser* browser) { | 95 LauncherFaviconLoader* GetFaviconLoader(Browser* browser) { |
95 BrowserView* browser_view = static_cast<BrowserView*>(browser->window()); | 96 BrowserView* browser_view = static_cast<BrowserView*>(browser->window()); |
96 BrowserLauncherItemController* launcher_item_controller = | 97 BrowserLauncherItemController* launcher_item_controller = |
97 browser_view->launcher_item_controller(); | 98 browser_view->launcher_item_controller(); |
98 if (!launcher_item_controller) | 99 if (!launcher_item_controller) |
99 return NULL; | 100 return NULL; |
(...skipping 87 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
187 NavigateTo(panel_browser, "launcher-smallfavicon.html"); | 188 NavigateTo(panel_browser, "launcher-smallfavicon.html"); |
188 EXPECT_TRUE(WaitForFaviconDownlads(1)); | 189 EXPECT_TRUE(WaitForFaviconDownlads(1)); |
189 EXPECT_TRUE(favicon_loader->GetFavicon().empty()); | 190 EXPECT_TRUE(favicon_loader->GetFavicon().empty()); |
190 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); | 191 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); |
191 | 192 |
192 NavigateTo(panel_browser, "launcher-largefavicon.html"); | 193 NavigateTo(panel_browser, "launcher-largefavicon.html"); |
193 EXPECT_TRUE(WaitForFaviconDownlads(1)); | 194 EXPECT_TRUE(WaitForFaviconDownlads(1)); |
194 EXPECT_FALSE(favicon_loader->GetFavicon().empty()); | 195 EXPECT_FALSE(favicon_loader->GetFavicon().empty()); |
195 EXPECT_EQ(128, favicon_loader->GetFavicon().height()); | 196 EXPECT_EQ(128, favicon_loader->GetFavicon().height()); |
196 } | 197 } |
OLD | NEW |