OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2012 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 <list> | 5 #include <list> |
6 #include <map> | 6 #include <map> |
7 #include <set> | 7 #include <set> |
8 #include <vector> | 8 #include <vector> |
9 | 9 |
10 #include "base/bind.h" | 10 #include "base/bind.h" |
(...skipping 28 matching lines...) Expand all Loading... |
39 #include "chrome/browser/google/google_util.h" | 39 #include "chrome/browser/google/google_util.h" |
40 #include "chrome/browser/prefs/pref_service_syncable.h" | 40 #include "chrome/browser/prefs/pref_service_syncable.h" |
41 #include "chrome/common/omaha_query_params/omaha_query_params.h" | 41 #include "chrome/common/omaha_query_params/omaha_query_params.h" |
42 #include "chrome/common/pref_names.h" | 42 #include "chrome/common/pref_names.h" |
43 #include "chrome/test/base/testing_profile.h" | 43 #include "chrome/test/base/testing_profile.h" |
44 #include "content/public/browser/notification_details.h" | 44 #include "content/public/browser/notification_details.h" |
45 #include "content/public/browser/notification_observer.h" | 45 #include "content/public/browser/notification_observer.h" |
46 #include "content/public/browser/notification_registrar.h" | 46 #include "content/public/browser/notification_registrar.h" |
47 #include "content/public/browser/notification_service.h" | 47 #include "content/public/browser/notification_service.h" |
48 #include "content/public/browser/notification_source.h" | 48 #include "content/public/browser/notification_source.h" |
49 #include "content/public/browser/render_process_host.h" | |
50 #include "content/public/test/test_browser_thread_bundle.h" | 49 #include "content/public/test/test_browser_thread_bundle.h" |
51 #include "content/public/test/test_utils.h" | 50 #include "content/public/test/test_utils.h" |
52 #include "extensions/common/extension.h" | 51 #include "extensions/common/extension.h" |
53 #include "extensions/common/id_util.h" | 52 #include "extensions/common/id_util.h" |
54 #include "extensions/common/manifest_constants.h" | 53 #include "extensions/common/manifest_constants.h" |
55 #include "libxml/globals.h" | 54 #include "libxml/globals.h" |
56 #include "net/base/backoff_entry.h" | 55 #include "net/base/backoff_entry.h" |
57 #include "net/base/escape.h" | 56 #include "net/base/escape.h" |
58 #include "net/base/load_flags.h" | 57 #include "net/base/load_flags.h" |
59 #include "net/url_request/test_url_fetcher_factory.h" | 58 #include "net/url_request/test_url_fetcher_factory.h" |
(...skipping 427 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
487 // inside this class (which is a friend to ExtensionUpdater). | 486 // inside this class (which is a friend to ExtensionUpdater). |
488 class ExtensionUpdaterTest : public testing::Test { | 487 class ExtensionUpdaterTest : public testing::Test { |
489 public: | 488 public: |
490 ExtensionUpdaterTest() | 489 ExtensionUpdaterTest() |
491 : thread_bundle_( | 490 : thread_bundle_( |
492 content::TestBrowserThreadBundle::IO_MAINLOOP) { | 491 content::TestBrowserThreadBundle::IO_MAINLOOP) { |
493 } | 492 } |
494 | 493 |
495 virtual void SetUp() OVERRIDE { | 494 virtual void SetUp() OVERRIDE { |
496 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); | 495 prefs_.reset(new TestExtensionPrefs(base::MessageLoopProxy::current())); |
497 content::RenderProcessHost::SetRunRendererInProcess(true); | |
498 } | 496 } |
499 | 497 |
500 virtual void TearDown() OVERRIDE { | 498 virtual void TearDown() OVERRIDE { |
501 // Some tests create URLRequestContextGetters, whose destruction must run | 499 // Some tests create URLRequestContextGetters, whose destruction must run |
502 // on the IO thread. Make sure the IO loop spins before shutdown so that | 500 // on the IO thread. Make sure the IO loop spins before shutdown so that |
503 // those objects are released. | 501 // those objects are released. |
504 RunUntilIdle(); | 502 RunUntilIdle(); |
505 prefs_.reset(); | 503 prefs_.reset(); |
506 content::RenderProcessHost::SetRunRendererInProcess(false); | |
507 } | 504 } |
508 | 505 |
509 void RunUntilIdle() { | 506 void RunUntilIdle() { |
510 prefs_->pref_service()->CommitPendingWrite(); | 507 prefs_->pref_service()->CommitPendingWrite(); |
511 base::RunLoop().RunUntilIdle(); | 508 base::RunLoop().RunUntilIdle(); |
512 } | 509 } |
513 | 510 |
514 void SimulateTimerFired(ExtensionUpdater* updater) { | 511 void SimulateTimerFired(ExtensionUpdater* updater) { |
515 EXPECT_TRUE(updater->timer_.IsRunning()); | 512 EXPECT_TRUE(updater->timer_.IsRunning()); |
516 updater->timer_.Stop(); | 513 updater->timer_.Stop(); |
(...skipping 869 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1386 EXPECT_FALSE(last_ping_day.is_null()); | 1383 EXPECT_FALSE(last_ping_day.is_null()); |
1387 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); | 1384 int64 seconds_diff = (Time::Now() - last_ping_day).InSeconds(); |
1388 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); | 1385 EXPECT_LT(seconds_diff - results.daystart_elapsed_seconds, 5); |
1389 } | 1386 } |
1390 | 1387 |
1391 protected: | 1388 protected: |
1392 scoped_ptr<TestExtensionPrefs> prefs_; | 1389 scoped_ptr<TestExtensionPrefs> prefs_; |
1393 | 1390 |
1394 private: | 1391 private: |
1395 content::TestBrowserThreadBundle thread_bundle_; | 1392 content::TestBrowserThreadBundle thread_bundle_; |
| 1393 content::InProcessUtilityThreadHelper in_process_utility_thread_helper_; |
1396 | 1394 |
1397 #if defined OS_CHROMEOS | 1395 #if defined OS_CHROMEOS |
1398 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; | 1396 chromeos::ScopedTestDeviceSettingsService test_device_settings_service_; |
1399 chromeos::ScopedTestCrosSettings test_cros_settings_; | 1397 chromeos::ScopedTestCrosSettings test_cros_settings_; |
1400 chromeos::ScopedTestUserManager test_user_manager_; | 1398 chromeos::ScopedTestUserManager test_user_manager_; |
1401 #endif | 1399 #endif |
1402 }; | 1400 }; |
1403 | 1401 |
1404 // Because we test some private methods of ExtensionUpdater, it's easier for the | 1402 // Because we test some private methods of ExtensionUpdater, it's easier for the |
1405 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F | 1403 // actual test code to live in ExtenionUpdaterTest methods instead of TEST_F |
(...skipping 233 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1639 // -prodversionmin (shouldn't update if browser version too old) | 1637 // -prodversionmin (shouldn't update if browser version too old) |
1640 // -manifests & updates arriving out of order / interleaved | 1638 // -manifests & updates arriving out of order / interleaved |
1641 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1639 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1642 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1640 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1643 // "come back from the dead") | 1641 // "come back from the dead") |
1644 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1642 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1645 // you don't get downgraded accidentally) | 1643 // you don't get downgraded accidentally) |
1646 // -An update manifest mentions multiple updates | 1644 // -An update manifest mentions multiple updates |
1647 | 1645 |
1648 } // namespace extensions | 1646 } // namespace extensions |
OLD | NEW |