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

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

Issue 2940023002: TaskScheduler: migrate appcache database over to use it. (Closed)
Patch Set: comments + rebase Created 3 years, 5 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
« no previous file with comments | « no previous file | content/browser/appcache/appcache_host_unittest.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 <stdint.h> 5 #include <stdint.h>
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/message_loop/message_loop.h" 9 #include "base/test/scoped_task_environment.h"
10 #include "content/browser/appcache/appcache.h" 10 #include "content/browser/appcache/appcache.h"
11 #include "content/browser/appcache/appcache_group.h" 11 #include "content/browser/appcache/appcache_group.h"
12 #include "content/browser/appcache/appcache_host.h" 12 #include "content/browser/appcache/appcache_host.h"
13 #include "content/browser/appcache/appcache_update_job.h" 13 #include "content/browser/appcache/appcache_update_job.h"
14 #include "content/browser/appcache/mock_appcache_service.h" 14 #include "content/browser/appcache/mock_appcache_service.h"
15 #include "content/common/appcache_interfaces.h" 15 #include "content/common/appcache_interfaces.h"
16 #include "testing/gtest/include/gtest/gtest.h" 16 #include "testing/gtest/include/gtest/gtest.h"
17 17
18 namespace { 18 namespace {
19 19
(...skipping 68 matching lines...) Expand 10 before | Expand all | Expand 10 after
88 88
89 void OnUpdateComplete(AppCacheGroup* group) override { 89 void OnUpdateComplete(AppCacheGroup* group) override {
90 update_completed_ = true; 90 update_completed_ = true;
91 } 91 }
92 92
93 bool update_completed_; 93 bool update_completed_;
94 }; 94 };
95 95
96 class AppCacheGroupTest : public testing::Test { 96 class AppCacheGroupTest : public testing::Test {
97 private: 97 private:
98 base::MessageLoop message_loop_; 98 base::test::ScopedTaskEnvironment scoped_task_environment_;
99 }; 99 };
100 100
101 TEST_F(AppCacheGroupTest, AddRemoveCache) { 101 TEST_F(AppCacheGroupTest, AddRemoveCache) {
102 MockAppCacheService service; 102 MockAppCacheService service;
103 scoped_refptr<AppCacheGroup> group( 103 scoped_refptr<AppCacheGroup> group(
104 new AppCacheGroup(service.storage(), GURL("http://foo.com"), 111)); 104 new AppCacheGroup(service.storage(), GURL("http://foo.com"), 111));
105 105
106 base::Time now = base::Time::Now(); 106 base::Time now = base::Time::Now();
107 107
108 scoped_refptr<AppCache> cache1(new AppCache(service.storage(), 111)); 108 scoped_refptr<AppCache> cache1(new AppCache(service.storage(), 111));
(...skipping 182 matching lines...) Expand 10 before | Expand all | Expand 10 after
291 EXPECT_TRUE(group->FindObserver(&host, group->observers_)); 291 EXPECT_TRUE(group->FindObserver(&host, group->observers_));
292 292
293 // Delete update to cause it to complete. Verify host is notified. 293 // Delete update to cause it to complete. Verify host is notified.
294 delete group->update_job_; 294 delete group->update_job_;
295 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_); 295 EXPECT_EQ(AppCacheGroup::IDLE, group->update_status_);
296 EXPECT_TRUE(group->restart_update_task_.IsCancelled()); 296 EXPECT_TRUE(group->restart_update_task_.IsCancelled());
297 EXPECT_TRUE(host.update_completed_); 297 EXPECT_TRUE(host.update_completed_);
298 } 298 }
299 299
300 } // namespace content 300 } // namespace content
OLDNEW
« no previous file with comments | « no previous file | content/browser/appcache/appcache_host_unittest.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698