Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(30)

Side by Side Diff: chrome/browser/task_manager/providers/web_contents/tab_contents_tag_browsertest.cc

Issue 2835233002: Fix integration tests in src/chrome and src/extensions so that we can turn on IO thread checks wi... (Closed)
Patch Set: ready for review Created 3 years, 8 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
1 // Copyright 2015 The Chromium Authors. All rights reserved. 1 // Copyright 2015 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 <stddef.h> 5 #include <stddef.h>
6 6
7 #include "base/macros.h" 7 #include "base/macros.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/utf_string_conversions.h" 9 #include "base/strings/utf_string_conversions.h"
10 #include "base/threading/thread_restrictions.h"
10 #include "chrome/browser/task_manager/mock_web_contents_task_manager.h" 11 #include "chrome/browser/task_manager/mock_web_contents_task_manager.h"
11 #include "chrome/browser/task_manager/providers/web_contents/web_contents_tags_m anager.h" 12 #include "chrome/browser/task_manager/providers/web_contents/web_contents_tags_m anager.h"
12 #include "chrome/browser/ui/browser.h" 13 #include "chrome/browser/ui/browser.h"
13 #include "chrome/browser/ui/tabs/tab_strip_model.h" 14 #include "chrome/browser/ui/tabs/tab_strip_model.h"
14 #include "chrome/common/chrome_paths.h" 15 #include "chrome/common/chrome_paths.h"
15 #include "chrome/grit/generated_resources.h" 16 #include "chrome/grit/generated_resources.h"
16 #include "chrome/test/base/in_process_browser_test.h" 17 #include "chrome/test/base/in_process_browser_test.h"
17 #include "chrome/test/base/ui_test_utils.h" 18 #include "chrome/test/base/ui_test_utils.h"
18 #include "components/favicon/content/content_favicon_driver.h" 19 #include "components/favicon/content/content_favicon_driver.h"
19 #include "components/favicon/core/favicon_driver.h" 20 #include "components/favicon/core/favicon_driver.h"
(...skipping 267 matching lines...) Expand 10 before | Expand all | Expand 10 after
287 favicon::ContentFaviconDriver* favicon_driver = 288 favicon::ContentFaviconDriver* favicon_driver =
288 favicon::ContentFaviconDriver::FromWebContents( 289 favicon::ContentFaviconDriver::FromWebContents(
289 browser()->tab_strip_model()->GetActiveWebContents()); 290 browser()->tab_strip_model()->GetActiveWebContents());
290 FaviconWaiter waiter(favicon_driver); 291 FaviconWaiter waiter(favicon_driver);
291 waiter.WaitForFaviconWithURL(GetUrlOfFile("/favicon/icon.png")); 292 waiter.WaitForFaviconWithURL(GetUrlOfFile("/favicon/icon.png"));
292 293
293 // Check that the task manager uses the specified favicon for the page. 294 // Check that the task manager uses the specified favicon for the page.
294 base::FilePath test_dir; 295 base::FilePath test_dir;
295 PathService::Get(chrome::DIR_TEST_DATA, &test_dir); 296 PathService::Get(chrome::DIR_TEST_DATA, &test_dir);
296 std::string favicon_string; 297 std::string favicon_string;
297 base::ReadFileToString( 298 {
298 test_dir.AppendASCII("favicon").AppendASCII("icon.png"), &favicon_string); 299 base::ThreadRestrictions::ScopedAllowIO allow_io;
300 base::ReadFileToString(
301 test_dir.AppendASCII("favicon").AppendASCII("icon.png"),
302 &favicon_string);
303 }
299 SkBitmap favicon_bitmap; 304 SkBitmap favicon_bitmap;
300 gfx::PNGCodec::Decode( 305 gfx::PNGCodec::Decode(
301 reinterpret_cast<const unsigned char*>(favicon_string.data()), 306 reinterpret_cast<const unsigned char*>(favicon_string.data()),
302 favicon_string.length(), &favicon_bitmap); 307 favicon_string.length(), &favicon_bitmap);
303 ASSERT_TRUE( 308 ASSERT_TRUE(
304 gfx::test::AreBitmapsEqual(favicon_bitmap, *task->icon().bitmap())); 309 gfx::test::AreBitmapsEqual(favicon_bitmap, *task->icon().bitmap()));
305 310
306 // Navigate to a page without a favicon. 311 // Navigate to a page without a favicon.
307 GURL no_favicon_page_url = GetUrlOfFile("/title1.html"); 312 GURL no_favicon_page_url = GetUrlOfFile("/title1.html");
308 ui_test_utils::NavigateToURL(browser(), no_favicon_page_url); 313 ui_test_utils::NavigateToURL(browser(), no_favicon_page_url);
309 ASSERT_EQ(GetDefaultTitleForUrl(no_favicon_page_url), task->title()); 314 ASSERT_EQ(GetDefaultTitleForUrl(no_favicon_page_url), task->title());
310 315
311 // Check that the task manager uses the default favicon for the page. 316 // Check that the task manager uses the default favicon for the page.
312 gfx::Image default_favicon_image = 317 gfx::Image default_favicon_image =
313 ResourceBundle::GetSharedInstance().GetNativeImageNamed( 318 ResourceBundle::GetSharedInstance().GetNativeImageNamed(
314 IDR_DEFAULT_FAVICON); 319 IDR_DEFAULT_FAVICON);
315 EXPECT_TRUE(gfx::test::AreImagesEqual(default_favicon_image, 320 EXPECT_TRUE(gfx::test::AreImagesEqual(default_favicon_image,
316 gfx::Image(task->icon()))); 321 gfx::Image(task->icon())));
317 } 322 }
318 323
319 } // namespace task_manager 324 } // namespace task_manager
OLDNEW
« no previous file with comments | « chrome/browser/sync/test/integration/sync_test.cc ('k') | chrome/browser/themes/theme_service_browsertest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698