| 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/ash/launcher/launcher_favicon_loader.h" | 5 #include "chrome/browser/ui/ash/launcher/launcher_favicon_loader.h" |
| 6 | 6 |
| 7 #include <stdint.h> | 7 #include <stdint.h> |
| 8 | 8 |
| 9 #include <memory> |
| 10 |
| 9 #include "ash/shelf/shelf_constants.h" | 11 #include "ash/shelf/shelf_constants.h" |
| 10 #include "base/macros.h" | 12 #include "base/macros.h" |
| 11 #include "base/memory/scoped_ptr.h" | |
| 12 #include "base/strings/stringprintf.h" | 13 #include "base/strings/stringprintf.h" |
| 13 #include "chrome/browser/ui/browser.h" | 14 #include "chrome/browser/ui/browser.h" |
| 14 #include "chrome/browser/ui/tabs/tab_strip_model.h" | 15 #include "chrome/browser/ui/tabs/tab_strip_model.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_observer.h" | 19 #include "content/public/browser/web_contents_observer.h" |
| 19 #include "net/test/embedded_test_server/embedded_test_server.h" | 20 #include "net/test/embedded_test_server/embedded_test_server.h" |
| 20 #include "third_party/skia/include/core/SkBitmap.h" | 21 #include "third_party/skia/include/core/SkBitmap.h" |
| 21 | 22 |
| (...skipping 93 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 115 } | 116 } |
| 116 } | 117 } |
| 117 return true; | 118 return true; |
| 118 } | 119 } |
| 119 | 120 |
| 120 void ResetDownloads() { | 121 void ResetDownloads() { |
| 121 contents_observer_->Reset(); | 122 contents_observer_->Reset(); |
| 122 } | 123 } |
| 123 | 124 |
| 124 bool favicon_updated_; | 125 bool favicon_updated_; |
| 125 scoped_ptr<ContentsObserver> contents_observer_; | 126 std::unique_ptr<ContentsObserver> contents_observer_; |
| 126 scoped_ptr<LauncherFaviconLoader> favicon_loader_; | 127 std::unique_ptr<LauncherFaviconLoader> favicon_loader_; |
| 127 | 128 |
| 128 private: | 129 private: |
| 129 DISALLOW_COPY_AND_ASSIGN(LauncherFaviconLoaderBrowsertest); | 130 DISALLOW_COPY_AND_ASSIGN(LauncherFaviconLoaderBrowsertest); |
| 130 }; | 131 }; |
| 131 | 132 |
| 132 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, SmallLauncherIcon) { | 133 IN_PROC_BROWSER_TEST_F(LauncherFaviconLoaderBrowsertest, SmallLauncherIcon) { |
| 133 ASSERT_TRUE(embedded_test_server()->Start()); | 134 ASSERT_TRUE(embedded_test_server()->Start()); |
| 134 ASSERT_TRUE(NavigateTo("launcher-smallfavicon.html")); | 135 ASSERT_TRUE(NavigateTo("launcher-smallfavicon.html")); |
| 135 EXPECT_TRUE(WaitForContentsLoaded()); | 136 EXPECT_TRUE(WaitForContentsLoaded()); |
| 136 EXPECT_TRUE(WaitForFaviconUpdated()); | 137 EXPECT_TRUE(WaitForFaviconUpdated()); |
| (...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 179 EXPECT_TRUE(favicon_loader_->GetFavicon().empty()); | 180 EXPECT_TRUE(favicon_loader_->GetFavicon().empty()); |
| 180 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); | 181 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); |
| 181 | 182 |
| 182 ASSERT_TRUE(NavigateTo("launcher-largefavicon.html")); | 183 ASSERT_TRUE(NavigateTo("launcher-largefavicon.html")); |
| 183 ASSERT_TRUE(WaitForContentsLoaded()); | 184 ASSERT_TRUE(WaitForContentsLoaded()); |
| 184 EXPECT_TRUE(WaitForFaviconUpdated()); | 185 EXPECT_TRUE(WaitForFaviconUpdated()); |
| 185 | 186 |
| 186 EXPECT_FALSE(favicon_loader_->GetFavicon().empty()); | 187 EXPECT_FALSE(favicon_loader_->GetFavicon().empty()); |
| 187 EXPECT_EQ(128, favicon_loader_->GetFavicon().height()); | 188 EXPECT_EQ(128, favicon_loader_->GetFavicon().height()); |
| 188 } | 189 } |
| OLD | NEW |