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

Side by Side Diff: chrome/browser/policy/component_cloud_policy_updater_unittest.cc

Issue 12542015: Fixed a glitch in the ComponentCloudPolicyUpdater where a protobuf field was read before being vali… (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 9 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 | Annotate | Revision Log
« no previous file with comments | « chrome/browser/policy/component_cloud_policy_updater.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2013 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2013 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/policy/component_cloud_policy_updater.h" 5 #include "chrome/browser/policy/component_cloud_policy_updater.h"
6 6
7 #include <string> 7 #include <string>
8 8
9 #include "base/basictypes.h" 9 #include "base/basictypes.h"
10 #include "base/files/scoped_temp_dir.h" 10 #include "base/files/scoped_temp_dir.h"
(...skipping 410 matching lines...) Expand 10 before | Expand all | Expand 10 after
421 fetcher->set_response_code(500); 421 fetcher->set_response_code(500);
422 fetcher->delegate()->OnURLFetchComplete(fetcher); 422 fetcher->delegate()->OnURLFetchComplete(fetcher);
423 423
424 // Now the second job was invalidated, and the third job (for the same 424 // Now the second job was invalidated, and the third job (for the same
425 // extension) is the next one. 425 // extension) is the next one.
426 fetcher = GetCurrentFetcher(); 426 fetcher = GetCurrentFetcher();
427 ASSERT_TRUE(fetcher); 427 ASSERT_TRUE(fetcher);
428 EXPECT_EQ(GURL(kTestDownload3), fetcher->GetOriginalURL()); 428 EXPECT_EQ(GURL(kTestDownload3), fetcher->GetOriginalURL());
429 } 429 }
430 430
431 TEST_F(ComponentCloudPolicyUpdaterTest, NoPolicy) {
432 // Start a fetch with a valid download url.
433 updater_->UpdateExternalPolicy(CreateResponse());
434 net::TestURLFetcher* fetcher = GetCurrentFetcher();
435 ASSERT_TRUE(fetcher);
436
437 // Now update the policy fetch response before the fetch completes. The new
438 // data does not have a download url.
439 builder_.payload().Clear();
440 updater_->UpdateExternalPolicy(CreateResponse());
441
442 // The download has been cancelled.
443 fetcher = GetCurrentFetcher();
444 ASSERT_FALSE(fetcher);
445 }
446
431 } // namespace policy 447 } // namespace policy
OLDNEW
« no previous file with comments | « chrome/browser/policy/component_cloud_policy_updater.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698