| 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 // TODO(rickcam): Bug 73183: Add unit tests for image loading | 5 // TODO(rickcam): Bug 73183: Add unit tests for image loading |
| 6 | 6 |
| 7 #include <cstdlib> | 7 #include <cstdlib> |
| 8 #include <set> | 8 #include <set> |
| 9 | 9 |
| 10 #include "chrome/browser/background/background_application_list_model.h" | 10 #include "chrome/browser/background/background_application_list_model.h" |
| 11 | 11 |
| 12 #include "base/command_line.h" | 12 #include "base/command_line.h" |
| 13 #include "base/files/file_path.h" | 13 #include "base/files/file_path.h" |
| 14 #include "base/memory/scoped_ptr.h" | 14 #include "base/memory/scoped_ptr.h" |
| 15 #include "base/message_loop/message_loop.h" | 15 #include "base/message_loop/message_loop.h" |
| 16 #include "base/stl_util.h" | 16 #include "base/stl_util.h" |
| 17 #include "chrome/browser/extensions/extension_service.h" | 17 #include "chrome/browser/extensions/extension_service.h" |
| 18 #include "chrome/browser/extensions/extension_service_unittest.h" | 18 #include "chrome/browser/extensions/extension_service_test_base.h" |
| 19 #include "chrome/browser/extensions/permissions_updater.h" | 19 #include "chrome/browser/extensions/permissions_updater.h" |
| 20 #include "chrome/test/base/testing_profile.h" | 20 #include "chrome/test/base/testing_profile.h" |
| 21 #include "content/public/browser/notification_registrar.h" | 21 #include "content/public/browser/notification_registrar.h" |
| 22 #include "content/public/browser/notification_types.h" | 22 #include "content/public/browser/notification_types.h" |
| 23 #include "extensions/browser/extension_system.h" | 23 #include "extensions/browser/extension_system.h" |
| 24 #include "extensions/common/extension.h" | 24 #include "extensions/common/extension.h" |
| 25 #include "extensions/common/manifest_constants.h" | 25 #include "extensions/common/manifest_constants.h" |
| 26 #include "extensions/common/permissions/api_permission.h" | 26 #include "extensions/common/permissions/api_permission.h" |
| 27 #include "extensions/common/permissions/permission_set.h" | 27 #include "extensions/common/permissions/permission_set.h" |
| 28 #include "extensions/common/permissions/permissions_data.h" | 28 #include "extensions/common/permissions/permissions_data.h" |
| 29 #include "testing/gtest/include/gtest/gtest.h" | 29 #include "testing/gtest/include/gtest/gtest.h" |
| 30 | 30 |
| 31 // This value is used to seed the PRNG at the beginning of a sequence of | 31 // This value is used to seed the PRNG at the beginning of a sequence of |
| 32 // operations to produce a repeatable sequence. | 32 // operations to produce a repeatable sequence. |
| 33 #define RANDOM_SEED (0x33F7A7A7) | 33 #define RANDOM_SEED (0x33F7A7A7) |
| 34 | 34 |
| 35 using extensions::APIPermission; | 35 using extensions::APIPermission; |
| 36 using extensions::Extension; | 36 using extensions::Extension; |
| 37 | 37 |
| 38 // For ExtensionService interface when it requires a path that is not used. | 38 // For ExtensionService interface when it requires a path that is not used. |
| 39 base::FilePath bogus_file_pathname(const std::string& name) { | 39 base::FilePath bogus_file_pathname(const std::string& name) { |
| 40 return base::FilePath(FILE_PATH_LITERAL("//foobar_nonexistent")) | 40 return base::FilePath(FILE_PATH_LITERAL("//foobar_nonexistent")) |
| 41 .AppendASCII(name); | 41 .AppendASCII(name); |
| 42 } | 42 } |
| 43 | 43 |
| 44 class BackgroundApplicationListModelTest : public ExtensionServiceTestBase { | 44 class BackgroundApplicationListModelTest |
| 45 : public extensions::ExtensionServiceTestBase { |
| 45 public: | 46 public: |
| 46 BackgroundApplicationListModelTest() {} | 47 BackgroundApplicationListModelTest() {} |
| 47 virtual ~BackgroundApplicationListModelTest() {} | 48 virtual ~BackgroundApplicationListModelTest() {} |
| 48 | 49 |
| 49 protected: | 50 protected: |
| 50 void InitializeAndLoadEmptyExtensionService() { | 51 void InitializeAndLoadEmptyExtensionService() { |
| 51 InitializeEmptyExtensionService(); | 52 InitializeEmptyExtensionService(); |
| 52 service_->Init(); /* Sends EXTENSIONS_READY */ | 53 service_->Init(); /* Sends EXTENSIONS_READY */ |
| 53 } | 54 } |
| 54 | 55 |
| (...skipping 435 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
| 490 break; | 491 break; |
| 491 case 2: | 492 case 2: |
| 492 TogglePermission(service, &extensions, model.get(), &expected, &count); | 493 TogglePermission(service, &extensions, model.get(), &expected, &count); |
| 493 break; | 494 break; |
| 494 default: | 495 default: |
| 495 NOTREACHED(); | 496 NOTREACHED(); |
| 496 break; | 497 break; |
| 497 } | 498 } |
| 498 } | 499 } |
| 499 } | 500 } |
| OLD | NEW |