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

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

Issue 2711693002: [Offline Pages] Make prerenderer notify us of network progress. (Closed)
Patch Set: last minute fixes Created 3 years, 10 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 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/core/downloads/download_ui_adapter.h" 5 #include "components/offline_pages/core/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 437 matching lines...) Expand 10 before | Expand all | Expand 10 after
448 adapter->RemoveObserver(this); 448 adapter->RemoveObserver(this);
449 items_loaded = false; 449 items_loaded = false;
450 450
451 PumpLoop(); 451 PumpLoop();
452 452
453 adapter->AddObserver(this); 453 adapter->AddObserver(this);
454 PumpLoop(); 454 PumpLoop();
455 EXPECT_TRUE(items_loaded); 455 EXPECT_TRUE(items_loaded);
456 } 456 }
457 457
458 TEST_F(DownloadUIAdapterTest, UpdateProgress) {
459 offliner_stub->enable_callback(true);
460 AddRequest(GURL(kTestUrl), kTestClientId1);
461 PumpLoop();
462
463 int64_t offline_id = adapter->GetOfflineIdByGuid(kTestGuid1);
464 const DownloadUIItem* item = adapter->GetItem(kTestGuid1);
465
466 ASSERT_NE(nullptr, item);
467 EXPECT_EQ(item->download_progress_bytes, 0);
468 updated_guids.clear();
469
470 adapter->UpdateProgress(offline_id, 15);
471 EXPECT_EQ(kTestGuid1, updated_guids[0]);
472 EXPECT_EQ(item->download_progress_bytes, 15);
473 }
474
458 } // namespace offline_pages 475 } // namespace offline_pages
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698