| 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 "ash/shelf/shelf_constants.h" | 7 #include "ash/shelf/shelf_constants.h" |
| 8 #include "base/memory/scoped_ptr.h" | 8 #include "base/memory/scoped_ptr.h" |
| 9 #include "base/strings/stringprintf.h" | 9 #include "base/strings/stringprintf.h" |
| 10 #include "chrome/browser/ui/browser.h" | 10 #include "chrome/browser/ui/browser.h" |
| (...skipping 21 matching lines...) Expand all Loading... |
| 32 virtual ~ContentsObserver() {} | 32 virtual ~ContentsObserver() {} |
| 33 | 33 |
| 34 void Reset() { | 34 void Reset() { |
| 35 got_favicons_ = false; | 35 got_favicons_ = false; |
| 36 } | 36 } |
| 37 | 37 |
| 38 bool loaded() const { return loaded_; } | 38 bool loaded() const { return loaded_; } |
| 39 bool got_favicons() const { return got_favicons_; } | 39 bool got_favicons() const { return got_favicons_; } |
| 40 | 40 |
| 41 // WebContentsObserver overrides. | 41 // WebContentsObserver overrides. |
| 42 virtual void DidFinishLoad( | 42 virtual void DidFinishLoad(content::RenderFrameHost* render_frame_host, |
| 43 int64 frame_id, | 43 const GURL& validated_url) OVERRIDE { |
| 44 const GURL& validated_url, | |
| 45 bool is_main_frame, | |
| 46 content::RenderViewHost* render_view_host) OVERRIDE { | |
| 47 loaded_ = true; | 44 loaded_ = true; |
| 48 } | 45 } |
| 49 | 46 |
| 50 virtual void DidUpdateFaviconURL( | 47 virtual void DidUpdateFaviconURL( |
| 51 const std::vector<content::FaviconURL>& candidates) OVERRIDE { | 48 const std::vector<content::FaviconURL>& candidates) OVERRIDE { |
| 52 if (!candidates.empty()) | 49 if (!candidates.empty()) |
| 53 got_favicons_ = true; | 50 got_favicons_ = true; |
| 54 } | 51 } |
| 55 | 52 |
| 56 private: | 53 private: |
| (...skipping 123 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 180 EXPECT_TRUE(favicon_loader_->GetFavicon().empty()); | 177 EXPECT_TRUE(favicon_loader_->GetFavicon().empty()); |
| 181 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); | 178 ASSERT_NO_FATAL_FAILURE(ResetDownloads()); |
| 182 | 179 |
| 183 ASSERT_TRUE(NavigateTo("launcher-largefavicon.html")); | 180 ASSERT_TRUE(NavigateTo("launcher-largefavicon.html")); |
| 184 ASSERT_TRUE(WaitForContentsLoaded()); | 181 ASSERT_TRUE(WaitForContentsLoaded()); |
| 185 EXPECT_TRUE(WaitForFaviconUpdated()); | 182 EXPECT_TRUE(WaitForFaviconUpdated()); |
| 186 | 183 |
| 187 EXPECT_FALSE(favicon_loader_->GetFavicon().empty()); | 184 EXPECT_FALSE(favicon_loader_->GetFavicon().empty()); |
| 188 EXPECT_EQ(128, favicon_loader_->GetFavicon().height()); | 185 EXPECT_EQ(128, favicon_loader_->GetFavicon().height()); |
| 189 } | 186 } |
| OLD | NEW |