OLD | NEW |
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 Loading... |
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 |
OLD | NEW |