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

Side by Side Diff: chrome/browser/sync/test/integration/bookmarks_helper.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, 7 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 (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/sync/test/integration/bookmarks_helper.h" 5 #include "chrome/browser/sync/test/integration/bookmarks_helper.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <set> 10 #include <set>
11 #include <stack> 11 #include <stack>
12 #include <vector> 12 #include <vector>
13 13
14 #include "base/bind.h" 14 #include "base/bind.h"
15 #include "base/files/file_util.h" 15 #include "base/files/file_util.h"
16 #include "base/macros.h" 16 #include "base/macros.h"
17 #include "base/memory/ptr_util.h" 17 #include "base/memory/ptr_util.h"
18 #include "base/path_service.h" 18 #include "base/path_service.h"
19 #include "base/rand_util.h" 19 #include "base/rand_util.h"
20 #include "base/run_loop.h" 20 #include "base/run_loop.h"
21 #include "base/strings/string_number_conversions.h" 21 #include "base/strings/string_number_conversions.h"
22 #include "base/strings/string_util.h" 22 #include "base/strings/string_util.h"
23 #include "base/strings/stringprintf.h" 23 #include "base/strings/stringprintf.h"
24 #include "base/strings/utf_string_conversions.h" 24 #include "base/strings/utf_string_conversions.h"
25 #include "base/synchronization/waitable_event.h" 25 #include "base/synchronization/waitable_event.h"
26 #include "base/task/cancelable_task_tracker.h" 26 #include "base/task/cancelable_task_tracker.h"
27 #include "base/threading/thread_restrictions.h"
27 #include "chrome/browser/bookmarks/bookmark_model_factory.h" 28 #include "chrome/browser/bookmarks/bookmark_model_factory.h"
28 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h" 29 #include "chrome/browser/bookmarks/managed_bookmark_service_factory.h"
29 #include "chrome/browser/favicon/favicon_service_factory.h" 30 #include "chrome/browser/favicon/favicon_service_factory.h"
30 #include "chrome/browser/history/history_service_factory.h" 31 #include "chrome/browser/history/history_service_factory.h"
31 #include "chrome/browser/profiles/profile.h" 32 #include "chrome/browser/profiles/profile.h"
32 #include "chrome/browser/sync/profile_sync_service_factory.h" 33 #include "chrome/browser/sync/profile_sync_service_factory.h"
33 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h" 34 #include "chrome/browser/sync/test/integration/profile_sync_service_harness.h"
34 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h" 35 #include "chrome/browser/sync/test/integration/sync_datatype_helper.h"
35 #include "chrome/browser/sync/test/integration/sync_test.h" 36 #include "chrome/browser/sync/test/integration/sync_test.h"
36 #include "chrome/common/chrome_paths.h" 37 #include "chrome/common/chrome_paths.h"
(...skipping 808 matching lines...) Expand 10 before | Expand all | Expand 10 after
845 int pixel_height = dip_height * scale; 846 int pixel_height = dip_height * scale;
846 SkBitmap bmp; 847 SkBitmap bmp;
847 bmp.allocN32Pixels(pixel_width, pixel_height); 848 bmp.allocN32Pixels(pixel_width, pixel_height);
848 bmp.eraseColor(color); 849 bmp.eraseColor(color);
849 favicon.AddRepresentation(gfx::ImageSkiaRep(bmp, scale)); 850 favicon.AddRepresentation(gfx::ImageSkiaRep(bmp, scale));
850 } 851 }
851 return gfx::Image(favicon); 852 return gfx::Image(favicon);
852 } 853 }
853 854
854 gfx::Image Create1xFaviconFromPNGFile(const std::string& path) { 855 gfx::Image Create1xFaviconFromPNGFile(const std::string& path) {
856 base::ThreadRestrictions::ScopedAllowIO allow_io;
855 const char* kPNGExtension = ".png"; 857 const char* kPNGExtension = ".png";
856 if (!base::EndsWith(path, kPNGExtension, 858 if (!base::EndsWith(path, kPNGExtension,
857 base::CompareCase::INSENSITIVE_ASCII)) 859 base::CompareCase::INSENSITIVE_ASCII))
858 return gfx::Image(); 860 return gfx::Image();
859 861
860 base::FilePath full_path; 862 base::FilePath full_path;
861 if (!PathService::Get(chrome::DIR_TEST_DATA, &full_path)) 863 if (!PathService::Get(chrome::DIR_TEST_DATA, &full_path))
862 return gfx::Image(); 864 return gfx::Image();
863 865
864 full_path = full_path.AppendASCII("sync").AppendASCII(path); 866 full_path = full_path.AppendASCII("sync").AppendASCII(path);
(...skipping 88 matching lines...) Expand 10 before | Expand all | Expand 10 after
953 } // namespace 955 } // namespace
954 956
955 BookmarksUrlChecker::BookmarksUrlChecker(int profile, 957 BookmarksUrlChecker::BookmarksUrlChecker(int profile,
956 const GURL& url, 958 const GURL& url,
957 int expected_count) 959 int expected_count)
958 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch, 960 : AwaitMatchStatusChangeChecker(base::Bind(BookmarkCountsByUrlMatch,
959 profile, 961 profile,
960 base::ConstRef(url), 962 base::ConstRef(url),
961 expected_count), 963 expected_count),
962 "Bookmark URL counts match.") {} 964 "Bookmark URL counts match.") {}
OLDNEW
« no previous file with comments | « chrome/browser/ssl/ssl_browser_tests.cc ('k') | chrome/browser/sync/test/integration/single_client_directory_sync_test.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698