Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(203)

Side by Side Diff: chrome/browser/extensions/extension_protocols_unittest.cc

Issue 12093036: Move Extension Location and Type enums to Manifest, and move InstallWarning to its own file. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Created 7 years, 10 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch | Annotate | Revision Log
OLDNEW
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 <string> 5 #include <string>
6 6
7 #include "base/file_util.h" 7 #include "base/file_util.h"
8 #include "base/message_loop.h" 8 #include "base/message_loop.h"
9 #include "chrome/browser/extensions/extension_info_map.h" 9 #include "chrome/browser/extensions/extension_info_map.h"
10 #include "chrome/browser/extensions/extension_protocols.h" 10 #include "chrome/browser/extensions/extension_protocols.h"
11 #include "chrome/common/chrome_paths.h" 11 #include "chrome/common/chrome_paths.h"
12 #include "chrome/common/url_constants.h" 12 #include "chrome/common/url_constants.h"
13 #include "content/public/browser/resource_request_info.h" 13 #include "content/public/browser/resource_request_info.h"
14 #include "content/public/test/mock_resource_context.h" 14 #include "content/public/test/mock_resource_context.h"
15 #include "content/public/test/test_browser_thread.h" 15 #include "content/public/test/test_browser_thread.h"
16 #include "extensions/common/constants.h" 16 #include "extensions/common/constants.h"
17 #include "net/url_request/url_request.h" 17 #include "net/url_request/url_request.h"
18 #include "net/url_request/url_request_job_factory_impl.h" 18 #include "net/url_request/url_request_job_factory_impl.h"
19 #include "net/url_request/url_request_status.h" 19 #include "net/url_request/url_request_status.h"
20 #include "net/url_request/url_request_test_util.h" 20 #include "net/url_request/url_request_test_util.h"
21 #include "testing/gtest/include/gtest/gtest.h" 21 #include "testing/gtest/include/gtest/gtest.h"
22 22
23 using content::BrowserThread; 23 using content::BrowserThread;
24 using extensions::Extension; 24 using extensions::Extension;
25 using extensions::Manifest;
25 26
26 namespace { 27 namespace {
27 28
28 scoped_refptr<Extension> CreateTestExtension(const std::string& name, 29 scoped_refptr<Extension> CreateTestExtension(const std::string& name,
29 bool incognito_split_mode) { 30 bool incognito_split_mode) {
30 DictionaryValue manifest; 31 DictionaryValue manifest;
31 manifest.SetString("name", name); 32 manifest.SetString("name", name);
32 manifest.SetString("version", "1"); 33 manifest.SetString("version", "1");
33 manifest.SetString("incognito", incognito_split_mode ? "split" : "spanning"); 34 manifest.SetString("incognito", incognito_split_mode ? "split" : "spanning");
34 35
35 FilePath path; 36 FilePath path;
36 EXPECT_TRUE(file_util::GetCurrentDirectory(&path)); 37 EXPECT_TRUE(file_util::GetCurrentDirectory(&path));
37 38
38 std::string error; 39 std::string error;
39 scoped_refptr<Extension> extension( 40 scoped_refptr<Extension> extension(
40 Extension::Create(path, Extension::INTERNAL, manifest, 41 Extension::Create(path, Manifest::INTERNAL, manifest,
41 Extension::NO_FLAGS, &error)); 42 Extension::NO_FLAGS, &error));
42 EXPECT_TRUE(extension.get()) << error; 43 EXPECT_TRUE(extension.get()) << error;
43 return extension; 44 return extension;
44 } 45 }
45 46
46 scoped_refptr<Extension> CreateWebStoreExtension() { 47 scoped_refptr<Extension> CreateWebStoreExtension() {
47 DictionaryValue manifest; 48 DictionaryValue manifest;
48 manifest.SetString("name", "WebStore"); 49 manifest.SetString("name", "WebStore");
49 manifest.SetString("version", "1"); 50 manifest.SetString("version", "1");
50 manifest.SetString("icons.16", "webstore_icon_16.png"); 51 manifest.SetString("icons.16", "webstore_icon_16.png");
51 52
52 FilePath path; 53 FilePath path;
53 EXPECT_TRUE(PathService::Get(chrome::DIR_RESOURCES, &path)); 54 EXPECT_TRUE(PathService::Get(chrome::DIR_RESOURCES, &path));
54 path = path.AppendASCII("web_store"); 55 path = path.AppendASCII("web_store");
55 56
56 std::string error; 57 std::string error;
57 scoped_refptr<Extension> extension( 58 scoped_refptr<Extension> extension(
58 Extension::Create(path, Extension::COMPONENT, manifest, 59 Extension::Create(path, Manifest::COMPONENT, manifest,
59 Extension::NO_FLAGS, &error)); 60 Extension::NO_FLAGS, &error));
60 EXPECT_TRUE(extension.get()) << error; 61 EXPECT_TRUE(extension.get()) << error;
61 return extension; 62 return extension;
62 } 63 }
63 64
64 class ExtensionProtocolTest : public testing::Test { 65 class ExtensionProtocolTest : public testing::Test {
65 public: 66 public:
66 ExtensionProtocolTest() 67 ExtensionProtocolTest()
67 : ui_thread_(BrowserThread::UI, &message_loop_), 68 : ui_thread_(BrowserThread::UI, &message_loop_),
68 file_thread_(BrowserThread::FILE, &message_loop_), 69 file_thread_(BrowserThread::FILE, &message_loop_),
(...skipping 138 matching lines...) Expand 10 before | Expand all | Expand 10 after
207 { 208 {
208 net::URLRequest request(extension->GetResourceURL("webstore_icon_16.png"), 209 net::URLRequest request(extension->GetResourceURL("webstore_icon_16.png"),
209 &test_delegate_, 210 &test_delegate_,
210 resource_context_.GetRequestContext()); 211 resource_context_.GetRequestContext());
211 StartRequest(&request, ResourceType::MEDIA); 212 StartRequest(&request, ResourceType::MEDIA);
212 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status()); 213 EXPECT_EQ(net::URLRequestStatus::SUCCESS, request.status().status());
213 } 214 }
214 } 215 }
215 216
216 } // namespace 217 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/extensions/extension_prefs_unittest.cc ('k') | chrome/browser/extensions/extension_service.h » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698