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

Side by Side Diff: components/offline_pages/downloads/download_ui_adapter_unittest.cc

Issue 2469933002: Offline Pages: Replace Observer::OfflinePageModelChanged with OfflinePageAdded. (Closed)
Patch Set: Rebase. Created 4 years 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 2016 The Chromium Authors. All rights reserved. 1 // Copyright 2016 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 "components/offline_pages/downloads/download_ui_adapter.h" 5 #include "components/offline_pages/downloads/download_ui_adapter.h"
6 6
7 #include <stdint.h> 7 #include <stdint.h>
8 8
9 #include <map> 9 #include <map>
10 #include <memory> 10 #include <memory>
(...skipping 90 matching lines...) Expand 10 before | Expand all | Expand 10 after
101 page.second.client_id); 101 page.second.client_id);
102 pages.erase(page.first); 102 pages.erase(page.first);
103 return; 103 return;
104 } 104 }
105 } 105 }
106 } 106 }
107 107
108 void AddPageAndNotifyAdapter(const OfflinePageItem& page) { 108 void AddPageAndNotifyAdapter(const OfflinePageItem& page) {
109 EXPECT_EQ(pages.end(), pages.find(page.offline_id)); 109 EXPECT_EQ(pages.end(), pages.find(page.offline_id));
110 pages[page.offline_id] = page; 110 pages[page.offline_id] = page;
111 observer_->OfflinePageModelChanged(this); 111 observer_->OfflinePageAdded(this, page);
112 } 112 }
113 113
114 ClientPolicyController* GetPolicyController() override { 114 ClientPolicyController* GetPolicyController() override {
115 return policy_controller_.get(); 115 return policy_controller_.get();
116 } 116 }
117 117
118 // Normally, OfflinePageModel owns this adapter, so lets test it this way. 118 // Normally, OfflinePageModel owns this adapter, so lets test it this way.
119 std::unique_ptr<DownloadUIAdapter> adapter; 119 std::unique_ptr<DownloadUIAdapter> adapter;
120 120
121 std::map<int64_t, OfflinePageItem> pages; 121 std::map<int64_t, OfflinePageItem> pages;
(...skipping 174 matching lines...) Expand 10 before | Expand all | Expand 10 after
296 model->adapter->RemoveObserver(this); 296 model->adapter->RemoveObserver(this);
297 // This will complete async fetch of items, but... 297 // This will complete async fetch of items, but...
298 PumpLoop(); 298 PumpLoop();
299 // items should not be loaded when there is no observers! 299 // items should not be loaded when there is no observers!
300 EXPECT_FALSE(items_loaded); 300 EXPECT_FALSE(items_loaded);
301 // This should not crash. 301 // This should not crash.
302 model->adapter->AddObserver(this); 302 model->adapter->AddObserver(this);
303 } 303 }
304 304
305 } // namespace offline_pages 305 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698