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 "base/command_line.h" | 5 #include "base/command_line.h" |
6 #include "base/json/json_file_value_serializer.h" | 6 #include "base/json/json_file_value_serializer.h" |
7 #include "base/message_loop/message_loop.h" | 7 #include "base/message_loop/message_loop.h" |
8 #include "base/path_service.h" | 8 #include "base/path_service.h" |
9 #include "base/strings/string_util.h" | 9 #include "base/strings/string_util.h" |
10 #include "chrome/browser/extensions/extension_service.h" | 10 #include "chrome/browser/extensions/extension_service.h" |
(...skipping 26 matching lines...) Expand all Loading... |
37 const char kAllHostsPermission[] = "*://*/*"; | 37 const char kAllHostsPermission[] = "*://*/*"; |
38 } | 38 } |
39 | 39 |
40 class ExtensionUITest : public testing::Test { | 40 class ExtensionUITest : public testing::Test { |
41 public: | 41 public: |
42 ExtensionUITest() | 42 ExtensionUITest() |
43 : ui_thread_(content::BrowserThread::UI, &message_loop_), | 43 : ui_thread_(content::BrowserThread::UI, &message_loop_), |
44 file_thread_(content::BrowserThread::FILE, &message_loop_) {} | 44 file_thread_(content::BrowserThread::FILE, &message_loop_) {} |
45 | 45 |
46 protected: | 46 protected: |
47 virtual void SetUp() OVERRIDE { | 47 virtual void SetUp() override { |
48 // Create an ExtensionService and ManagementPolicy to inject into the | 48 // Create an ExtensionService and ManagementPolicy to inject into the |
49 // ExtensionSettingsHandler. | 49 // ExtensionSettingsHandler. |
50 profile_.reset(new TestingProfile()); | 50 profile_.reset(new TestingProfile()); |
51 TestExtensionSystem* system = | 51 TestExtensionSystem* system = |
52 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile_.get())); | 52 static_cast<TestExtensionSystem*>(ExtensionSystem::Get(profile_.get())); |
53 extension_service_ = system->CreateExtensionService( | 53 extension_service_ = system->CreateExtensionService( |
54 CommandLine::ForCurrentProcess(), base::FilePath(), false); | 54 CommandLine::ForCurrentProcess(), base::FilePath(), false); |
55 management_policy_ = system->management_policy(); | 55 management_policy_ = system->management_policy(); |
56 | 56 |
57 handler_.reset(new ExtensionSettingsHandler(extension_service_, | 57 handler_.reset(new ExtensionSettingsHandler(extension_service_, |
58 management_policy_)); | 58 management_policy_)); |
59 } | 59 } |
60 | 60 |
61 virtual void TearDown() OVERRIDE { | 61 virtual void TearDown() override { |
62 handler_.reset(); | 62 handler_.reset(); |
63 profile_.reset(); | 63 profile_.reset(); |
64 // Execute any pending deletion tasks. | 64 // Execute any pending deletion tasks. |
65 message_loop_.RunUntilIdle(); | 65 message_loop_.RunUntilIdle(); |
66 } | 66 } |
67 | 67 |
68 static base::DictionaryValue* DeserializeJSONTestData( | 68 static base::DictionaryValue* DeserializeJSONTestData( |
69 const base::FilePath& path, | 69 const base::FilePath& path, |
70 std::string *error) { | 70 std::string *error) { |
71 base::Value* value; | 71 base::Value* value; |
(...skipping 307 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
379 // show up without the switch. | 379 // show up without the switch. |
380 value.reset(handler()->CreateExtensionDetailValue( | 380 value.reset(handler()->CreateExtensionDetailValue( |
381 all_urls_extension.get(), std::vector<ExtensionPage>(), NULL)); | 381 all_urls_extension.get(), std::vector<ExtensionPage>(), NULL)); |
382 EXPECT_TRUE(value->GetBoolean(kWantsAllUrls, &result)); | 382 EXPECT_TRUE(value->GetBoolean(kWantsAllUrls, &result)); |
383 EXPECT_FALSE(result); | 383 EXPECT_FALSE(result); |
384 EXPECT_TRUE(value->GetBoolean(kAllowAllUrls, &result)); | 384 EXPECT_TRUE(value->GetBoolean(kAllowAllUrls, &result)); |
385 EXPECT_FALSE(result); | 385 EXPECT_FALSE(result); |
386 } | 386 } |
387 | 387 |
388 } // namespace extensions | 388 } // namespace extensions |
OLD | NEW |