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

Side by Side Diff: chrome/test/base/module_system_test.cc

Issue 10412004: Revert "Revert 137734 - Select theme resources from ResourceBundle at requested scale factor." (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: Merge with master Created 8 years, 7 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 "chrome/test/base/module_system_test.h" 5 #include "chrome/test/base/module_system_test.h"
6 6
7 #include "base/callback.h" 7 #include "base/callback.h"
8 #include "base/memory/scoped_ptr.h" 8 #include "base/memory/scoped_ptr.h"
9 #include "base/string_piece.h" 9 #include "base/string_piece.h"
10 #include "chrome/renderer/native_handler.h" 10 #include "chrome/renderer/native_handler.h"
11 #include "ui/base/layout.h"
11 #include "ui/base/resource/resource_bundle.h" 12 #include "ui/base/resource/resource_bundle.h"
12 13
13 #include <map> 14 #include <map>
14 #include <string> 15 #include <string>
15 16
16 // Native JS functions for doing asserts. 17 // Native JS functions for doing asserts.
17 class AssertNatives : public NativeHandler { 18 class AssertNatives : public NativeHandler {
18 public: 19 public:
19 AssertNatives() 20 AssertNatives()
20 : assertion_made_(false), 21 : assertion_made_(false),
(...skipping 70 matching lines...) Expand 10 before | Expand all | Expand 10 after
91 } 92 }
92 93
93 void ModuleSystemTest::RegisterModule(const std::string& name, 94 void ModuleSystemTest::RegisterModule(const std::string& name,
94 const std::string& code) { 95 const std::string& code) {
95 source_map_->RegisterModule(name, code); 96 source_map_->RegisterModule(name, code);
96 } 97 }
97 98
98 void ModuleSystemTest::RegisterModule(const std::string& name, 99 void ModuleSystemTest::RegisterModule(const std::string& name,
99 int resource_id) { 100 int resource_id) {
100 const std::string& code = ResourceBundle::GetSharedInstance(). 101 const std::string& code = ResourceBundle::GetSharedInstance().
101 GetRawDataResource(resource_id).as_string(); 102 GetRawDataResource(resource_id,
103 ui::SCALE_FACTOR_NONE).as_string();
102 source_map_->RegisterModule(name, code); 104 source_map_->RegisterModule(name, code);
103 } 105 }
104 106
105 void ModuleSystemTest::OverrideNativeHandler(const std::string& name, 107 void ModuleSystemTest::OverrideNativeHandler(const std::string& name,
106 const std::string& code) { 108 const std::string& code) {
107 RegisterModule(name, code); 109 RegisterModule(name, code);
108 module_system_->OverrideNativeHandler(name); 110 module_system_->OverrideNativeHandler(name);
109 } 111 }
110 112
111 void ModuleSystemTest::TearDown() { 113 void ModuleSystemTest::TearDown() {
(...skipping 10 matching lines...) Expand all
122 should_assertions_be_made_ = false; 124 should_assertions_be_made_ = false;
123 } 125 }
124 126
125 v8::Handle<v8::Object> ModuleSystemTest::CreateGlobal(const std::string& name) { 127 v8::Handle<v8::Object> ModuleSystemTest::CreateGlobal(const std::string& name) {
126 v8::HandleScope handle_scope; 128 v8::HandleScope handle_scope;
127 v8::Handle<v8::Object> object = v8::Object::New(); 129 v8::Handle<v8::Object> object = v8::Object::New();
128 v8::Context::GetCurrent()->Global()->Set(v8::String::New(name.c_str()), 130 v8::Context::GetCurrent()->Global()->Set(v8::String::New(name.c_str()),
129 object); 131 object);
130 return handle_scope.Close(object); 132 return handle_scope.Close(object);
131 } 133 }
OLDNEW
« no previous file with comments | « chrome/test/base/chrome_test_suite.cc ('k') | chrome/tools/mac_helpers/infoplist_strings_util.mm » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698