OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 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 <map> | 5 #include <map> |
6 | 6 |
7 #include "base/compiler_specific.h" | 7 #include "base/compiler_specific.h" |
8 #include "base/file_util.h" | 8 #include "base/file_util.h" |
9 #include "base/memory/scoped_ptr.h" | 9 #include "base/memory/scoped_ptr.h" |
10 #include "base/memory/weak_ptr.h" | 10 #include "base/memory/weak_ptr.h" |
11 #include "base/stl_util.h" | 11 #include "base/stl_util.h" |
12 #include "base/string_number_conversions.h" | 12 #include "base/string_number_conversions.h" |
13 #include "base/string_split.h" | 13 #include "base/string_split.h" |
14 #include "base/string_util.h" | 14 #include "base/string_util.h" |
15 #include "base/stringprintf.h" | 15 #include "base/stringprintf.h" |
16 #include "base/threading/thread.h" | 16 #include "base/threading/thread.h" |
17 #include "base/version.h" | 17 #include "base/version.h" |
18 #include "chrome/browser/extensions/crx_installer.h" | 18 #include "chrome/browser/extensions/crx_installer.h" |
19 #include "chrome/browser/extensions/extension_error_reporter.h" | 19 #include "chrome/browser/extensions/extension_error_reporter.h" |
20 #include "chrome/browser/extensions/extension_sync_data.h" | 20 #include "chrome/browser/extensions/extension_sync_data.h" |
21 #include "chrome/browser/extensions/extension_updater.h" | 21 #include "chrome/browser/extensions/extension_updater.h" |
22 #include "chrome/browser/extensions/test_extension_prefs.h" | 22 #include "chrome/browser/extensions/test_extension_prefs.h" |
23 #include "chrome/browser/extensions/test_extension_service.h" | 23 #include "chrome/browser/extensions/test_extension_service.h" |
24 #include "chrome/browser/prefs/pref_service.h" | 24 #include "chrome/browser/prefs/pref_service.h" |
25 #include "chrome/common/extensions/extension.h" | 25 #include "chrome/common/extensions/extension.h" |
26 #include "chrome/common/extensions/extension_constants.h" | 26 #include "chrome/common/extensions/extension_constants.h" |
27 #include "chrome/common/pref_names.h" | 27 #include "chrome/common/pref_names.h" |
28 #include "chrome/test/base/testing_browser_process_test.h" | |
29 #include "chrome/test/base/testing_profile.h" | 28 #include "chrome/test/base/testing_profile.h" |
30 #include "content/browser/browser_thread.h" | 29 #include "content/browser/browser_thread.h" |
31 #include "content/test/test_url_fetcher_factory.h" | 30 #include "content/test/test_url_fetcher_factory.h" |
32 #include "libxml/globals.h" | 31 #include "libxml/globals.h" |
33 #include "net/base/escape.h" | 32 #include "net/base/escape.h" |
34 #include "net/base/load_flags.h" | 33 #include "net/base/load_flags.h" |
35 #include "net/url_request/url_request_status.h" | 34 #include "net/url_request/url_request_status.h" |
36 #include "testing/gtest/include/gtest/gtest.h" | 35 #include "testing/gtest/include/gtest/gtest.h" |
37 | 36 |
38 using base::Time; | 37 using base::Time; |
(...skipping 241 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
280 EXPECT_TRUE(result->find(key) == result->end()); | 279 EXPECT_TRUE(result->find(key) == result->end()); |
281 (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; | 280 (*result)[key] = (key_val.size() == 2) ? key_val[1] : ""; |
282 } else { | 281 } else { |
283 NOTREACHED(); | 282 NOTREACHED(); |
284 } | 283 } |
285 } | 284 } |
286 } | 285 } |
287 | 286 |
288 // All of our tests that need to use private APIs of ExtensionUpdater live | 287 // All of our tests that need to use private APIs of ExtensionUpdater live |
289 // inside this class (which is a friend to ExtensionUpdater). | 288 // inside this class (which is a friend to ExtensionUpdater). |
290 class ExtensionUpdaterTest : public TestingBrowserProcessTest { | 289 class ExtensionUpdaterTest : public testing::Test { |
291 public: | 290 public: |
292 static void SimulateTimerFired(ExtensionUpdater* updater) { | 291 static void SimulateTimerFired(ExtensionUpdater* updater) { |
293 EXPECT_TRUE(updater->timer_.IsRunning()); | 292 EXPECT_TRUE(updater->timer_.IsRunning()); |
294 updater->timer_.Stop(); | 293 updater->timer_.Stop(); |
295 updater->TimerFired(); | 294 updater->TimerFired(); |
296 } | 295 } |
297 | 296 |
298 static void SimulateCheckSoon(const ExtensionUpdater& updater, | 297 static void SimulateCheckSoon(const ExtensionUpdater& updater, |
299 MessageLoop* message_loop) { | 298 MessageLoop* message_loop) { |
300 EXPECT_TRUE(updater.will_check_soon_); | 299 EXPECT_TRUE(updater.will_check_soon_); |
(...skipping 926 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
1227 | 1226 |
1228 // TODO(asargent) - (http://crbug.com/12780) add tests for: | 1227 // TODO(asargent) - (http://crbug.com/12780) add tests for: |
1229 // -prodversionmin (shouldn't update if browser version too old) | 1228 // -prodversionmin (shouldn't update if browser version too old) |
1230 // -manifests & updates arriving out of order / interleaved | 1229 // -manifests & updates arriving out of order / interleaved |
1231 // -malformed update url (empty, file://, has query, has a # fragment, etc.) | 1230 // -malformed update url (empty, file://, has query, has a # fragment, etc.) |
1232 // -An extension gets uninstalled while updates are in progress (so it doesn't | 1231 // -An extension gets uninstalled while updates are in progress (so it doesn't |
1233 // "come back from the dead") | 1232 // "come back from the dead") |
1234 // -An extension gets manually updated to v3 while we're downloading v2 (ie | 1233 // -An extension gets manually updated to v3 while we're downloading v2 (ie |
1235 // you don't get downgraded accidentally) | 1234 // you don't get downgraded accidentally) |
1236 // -An update manifest mentions multiple updates | 1235 // -An update manifest mentions multiple updates |
OLD | NEW |