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

Side by Side Diff: content/browser/appcache/mock_appcache_storage_unittest.cc

Issue 2800893002: Use ScopedTaskEnvironment instead of MessageLoop in content unit tests. (Closed)
Patch Set: 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 2014 The Chromium Authors. All rights reserved. 1 // Copyright 2014 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 #include <stdint.h> 6 #include <stdint.h>
7 7
8 #include "base/run_loop.h" 8 #include "base/run_loop.h"
9 #include "base/test/scoped_task_environment.h"
9 #include "content/browser/appcache/appcache.h" 10 #include "content/browser/appcache/appcache.h"
10 #include "content/browser/appcache/appcache_group.h" 11 #include "content/browser/appcache/appcache_group.h"
11 #include "content/browser/appcache/appcache_response.h" 12 #include "content/browser/appcache/appcache_response.h"
12 #include "content/browser/appcache/appcache_storage.h" 13 #include "content/browser/appcache/appcache_storage.h"
13 #include "content/browser/appcache/mock_appcache_service.h" 14 #include "content/browser/appcache/mock_appcache_service.h"
14 #include "testing/gtest/include/gtest/gtest.h" 15 #include "testing/gtest/include/gtest/gtest.h"
15 16
16 namespace content { 17 namespace content {
17 18
18 class MockAppCacheStorageTest : public testing::Test { 19 class MockAppCacheStorageTest : public testing::Test {
(...skipping 56 matching lines...) Expand 10 before | Expand all | Expand 10 after
75 bool obsoleted_success_; 76 bool obsoleted_success_;
76 GURL found_url_; 77 GURL found_url_;
77 AppCacheEntry found_entry_; 78 AppCacheEntry found_entry_;
78 GURL found_fallback_url_; 79 GURL found_fallback_url_;
79 AppCacheEntry found_fallback_entry_; 80 AppCacheEntry found_fallback_entry_;
80 int64_t found_cache_id_; 81 int64_t found_cache_id_;
81 GURL found_manifest_url_; 82 GURL found_manifest_url_;
82 }; 83 };
83 84
84 private: 85 private:
85 base::MessageLoop message_loop_; 86 base::test::ScopedTaskEnvironment scoped_task_environment_;
86 }; 87 };
87 88
88 TEST_F(MockAppCacheStorageTest, LoadCache_Miss) { 89 TEST_F(MockAppCacheStorageTest, LoadCache_Miss) {
89 // Attempt to load a cache that doesn't exist. Should 90 // Attempt to load a cache that doesn't exist. Should
90 // complete asyncly. 91 // complete asyncly.
91 MockAppCacheService service; 92 MockAppCacheService service;
92 MockStorageDelegate delegate; 93 MockStorageDelegate delegate;
93 service.storage()->LoadCache(111, &delegate); 94 service.storage()->LoadCache(111, &delegate);
94 EXPECT_NE(111, delegate.loaded_cache_id_); 95 EXPECT_NE(111, delegate.loaded_cache_id_);
95 base::RunLoop().RunUntilIdle(); // Do async task execution. 96 base::RunLoop().RunUntilIdle(); // Do async task execution.
(...skipping 533 matching lines...) Expand 10 before | Expand all | Expand 10 after
629 EXPECT_EQ(kAppCacheNoCacheId, delegate.found_cache_id_); 630 EXPECT_EQ(kAppCacheNoCacheId, delegate.found_cache_id_);
630 EXPECT_EQ(kAppCacheNoResponseId, delegate.found_entry_.response_id()); 631 EXPECT_EQ(kAppCacheNoResponseId, delegate.found_entry_.response_id());
631 EXPECT_EQ(kAppCacheNoResponseId, 632 EXPECT_EQ(kAppCacheNoResponseId,
632 delegate.found_fallback_entry_.response_id()); 633 delegate.found_fallback_entry_.response_id());
633 EXPECT_TRUE(delegate.found_fallback_url_.is_empty()); 634 EXPECT_TRUE(delegate.found_fallback_url_.is_empty());
634 EXPECT_EQ(0, delegate.found_entry_.types()); 635 EXPECT_EQ(0, delegate.found_entry_.types());
635 EXPECT_EQ(0, delegate.found_fallback_entry_.types()); 636 EXPECT_EQ(0, delegate.found_fallback_entry_.types());
636 } 637 }
637 638
638 } // namespace content 639 } // namespace content
OLDNEW
« no previous file with comments | « content/browser/appcache/appcache_service_unittest.cc ('k') | content/browser/fileapi/copy_or_move_file_validator_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698