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

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

Issue 1120006: detect preferences errors (Closed)
Patch Set: changes from review Created 10 years, 8 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
OLDNEW
1 // Copyright (c) 2010 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2010 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/message_loop.h" 5 #include "base/message_loop.h"
6 #include "base/path_service.h" 6 #include "base/path_service.h"
7 #include "chrome/browser/chrome_thread.h" 7 #include "chrome/browser/chrome_thread.h"
8 #include "chrome/browser/extensions/image_loading_tracker.h" 8 #include "chrome/browser/extensions/image_loading_tracker.h"
9 #include "chrome/common/chrome_paths.h" 9 #include "chrome/common/chrome_paths.h"
10 #include "chrome/common/json_value_serializer.h" 10 #include "chrome/common/json_value_serializer.h"
(...skipping 38 matching lines...) Expand 10 before | Expand all | Expand 10 after
49 49
50 Extension* CreateExtension() { 50 Extension* CreateExtension() {
51 // Create and load an extension. 51 // Create and load an extension.
52 FilePath test_file; 52 FilePath test_file;
53 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) { 53 if (!PathService::Get(chrome::DIR_TEST_DATA, &test_file)) {
54 EXPECT_FALSE(true); 54 EXPECT_FALSE(true);
55 return NULL; 55 return NULL;
56 } 56 }
57 test_file = test_file.AppendASCII("extensions") 57 test_file = test_file.AppendASCII("extensions")
58 .AppendASCII("image_loading_tracker"); 58 .AppendASCII("image_loading_tracker");
59 int error_code;
59 std::string error; 60 std::string error;
60 JSONFileValueSerializer serializer(test_file.AppendASCII("app.json")); 61 JSONFileValueSerializer serializer(test_file.AppendASCII("app.json"));
61 scoped_ptr<DictionaryValue> valid_value( 62 scoped_ptr<DictionaryValue> valid_value(
62 static_cast<DictionaryValue*>(serializer.Deserialize(&error))); 63 static_cast<DictionaryValue*>(serializer.Deserialize(&error_code,
63 EXPECT_EQ("", error); 64 &error)));
64 if (error != "") 65 EXPECT_EQ(0, error_code) << error;
66 if (error_code != 0)
65 return NULL; 67 return NULL;
66 68
67 EXPECT_TRUE(valid_value.get()); 69 EXPECT_TRUE(valid_value.get());
68 if (!valid_value.get()) 70 if (!valid_value.get())
69 return NULL; 71 return NULL;
70 72
71 scoped_ptr<Extension> extension(new Extension(test_file)); 73 scoped_ptr<Extension> extension(new Extension(test_file));
72 if (!extension->InitFromValue(*valid_value, false, &error)) 74 if (!extension->InitFromValue(*valid_value, false, &error))
73 return NULL; 75 return NULL;
74 76
(...skipping 91 matching lines...) Expand 10 before | Expand all | Expand 10 after
166 168
167 WaitForImageLoad(); 169 WaitForImageLoad();
168 170
169 // Even though we deleted the extension, we should still get the image. 171 // Even though we deleted the extension, we should still get the image.
170 // We should still have gotten the image. 172 // We should still have gotten the image.
171 EXPECT_EQ(1, image_loaded_count()); 173 EXPECT_EQ(1, image_loaded_count());
172 174
173 // Check that the image was loaded. 175 // Check that the image was loaded.
174 EXPECT_EQ(Extension::EXTENSION_ICON_SMALLISH, image_.width()); 176 EXPECT_EQ(Extension::EXTENSION_ICON_SMALLISH, image_.width());
175 } 177 }
OLDNEW
« no previous file with comments | « chrome/browser/extensions/external_pref_extension_provider.cc ('k') | chrome/browser/geolocation/network_location_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698