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

Side by Side Diff: chrome/browser/ui/webui/sync_internals_ui_unittest.cc

Issue 7649006: more changes (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: fix another typo Created 9 years, 4 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) 2011 The Chromium Authors. All rights reserved. 1 // Copyright (c) 2011 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/browser/ui/webui/sync_internals_ui.h" 5 #include "chrome/browser/ui/webui/sync_internals_ui.h"
6 6
7 #include <cstddef> 7 #include <cstddef>
8 #include <string> 8 #include <string>
9 9
10 #include "base/message_loop.h" 10 #include "base/message_loop.h"
(...skipping 89 matching lines...) Expand 10 before | Expand all | Expand 10 after
100 test_sync_internals_ui_->HandleJsEvent("testMessage", JsEventDetails()); 100 test_sync_internals_ui_->HandleJsEvent("testMessage", JsEventDetails());
101 } 101 }
102 102
103 TEST_F(SyncInternalsUITestWithService, HandleJsReply) { 103 TEST_F(SyncInternalsUITestWithService, HandleJsReply) {
104 EXPECT_CALL( 104 EXPECT_CALL(
105 *test_sync_internals_ui_, 105 *test_sync_internals_ui_,
106 ExecuteJavascript( 106 ExecuteJavascript(
107 ASCIIToUTF16("chrome.sync.testMessage.handleReply(5,true);"))); 107 ASCIIToUTF16("chrome.sync.testMessage.handleReply(5,true);")));
108 108
109 ListValue args; 109 ListValue args;
110 args.Append(Value::CreateIntegerValue(5)); 110 args.Append(base::NumberValue::New(5));
111 args.Append(Value::CreateBooleanValue(true)); 111 args.Append(base::TrueValue());
112 test_sync_internals_ui_->HandleJsReply("testMessage", JsArgList(&args)); 112 test_sync_internals_ui_->HandleJsReply("testMessage", JsArgList(&args));
113 } 113 }
114 114
115 TEST_F(SyncInternalsUITestWithService, OnWebUISendBasic) { 115 TEST_F(SyncInternalsUITestWithService, OnWebUISendBasic) {
116 const std::string& name = "testName"; 116 const std::string& name = "testName";
117 ListValue args; 117 ListValue args;
118 args.Append(Value::CreateIntegerValue(10)); 118 args.Append(base::NumberValue::New(10));
119 119
120 EXPECT_CALL(mock_js_controller_, 120 EXPECT_CALL(mock_js_controller_,
121 ProcessJsMessage(name, HasArgsAsList(args), _)); 121 ProcessJsMessage(name, HasArgsAsList(args), _));
122 122
123 test_sync_internals_ui_->OnWebUISend(GURL(), name, args); 123 test_sync_internals_ui_->OnWebUISend(GURL(), name, args);
124 } 124 }
125 125
126 // Tests with NULL ProfileSyncService. 126 // Tests with NULL ProfileSyncService.
127 class SyncInternalsUITestWithoutService : public RenderViewHostTestHarness { 127 class SyncInternalsUITestWithoutService : public RenderViewHostTestHarness {
128 protected: 128 protected:
(...skipping 33 matching lines...) Expand 10 before | Expand all | Expand 10 after
162 test_sync_internals_ui_->HandleJsEvent("testMessage", JsEventDetails()); 162 test_sync_internals_ui_->HandleJsEvent("testMessage", JsEventDetails());
163 } 163 }
164 164
165 TEST_F(SyncInternalsUITestWithoutService, HandleJsReply) { 165 TEST_F(SyncInternalsUITestWithoutService, HandleJsReply) {
166 EXPECT_CALL( 166 EXPECT_CALL(
167 *test_sync_internals_ui_, 167 *test_sync_internals_ui_,
168 ExecuteJavascript( 168 ExecuteJavascript(
169 ASCIIToUTF16("chrome.sync.testMessage.handleReply(5,true);"))); 169 ASCIIToUTF16("chrome.sync.testMessage.handleReply(5,true);")));
170 170
171 ListValue args; 171 ListValue args;
172 args.Append(Value::CreateIntegerValue(5)); 172 args.Append(base::NumberValue::New(5));
173 args.Append(Value::CreateBooleanValue(true)); 173 args.Append(base::TrueValue());
174 test_sync_internals_ui_->HandleJsReply( 174 test_sync_internals_ui_->HandleJsReply(
175 "testMessage", JsArgList(&args)); 175 "testMessage", JsArgList(&args));
176 } 176 }
177 177
178 TEST_F(SyncInternalsUITestWithoutService, OnWebUISendBasic) { 178 TEST_F(SyncInternalsUITestWithoutService, OnWebUISendBasic) {
179 const std::string& name = "testName"; 179 const std::string& name = "testName";
180 ListValue args; 180 ListValue args;
181 args.Append(Value::CreateIntegerValue(5)); 181 args.Append(base::NumberValue::New(5));
182 182
183 // Should drop the message. 183 // Should drop the message.
184 test_sync_internals_ui_->OnWebUISend(GURL(), name, args); 184 test_sync_internals_ui_->OnWebUISend(GURL(), name, args);
185 } 185 }
186 186
187 // TODO(lipalani) - add a test case to test about:sync with a non null 187 // TODO(lipalani) - add a test case to test about:sync with a non null
188 // service. 188 // service.
189 TEST_F(SyncInternalsUITestWithoutService, OnWebUISendGetAboutInfo) { 189 TEST_F(SyncInternalsUITestWithoutService, OnWebUISendGetAboutInfo) {
190 const char kAboutInfoCall[] = 190 const char kAboutInfoCall[] =
191 "chrome.sync.getAboutInfo.handleReply({\"summary\":\"SYNC DISABLED\"});"; 191 "chrome.sync.getAboutInfo.handleReply({\"summary\":\"SYNC DISABLED\"});";
192 EXPECT_CALL(*test_sync_internals_ui_, 192 EXPECT_CALL(*test_sync_internals_ui_,
193 ExecuteJavascript(ASCIIToUTF16(kAboutInfoCall))); 193 ExecuteJavascript(ASCIIToUTF16(kAboutInfoCall)));
194 194
195 ListValue args; 195 ListValue args;
196 test_sync_internals_ui_->OnWebUISend(GURL(), "getAboutInfo", args); 196 test_sync_internals_ui_->OnWebUISend(GURL(), "getAboutInfo", args);
197 } 197 }
198 198
199 } // namespace 199 } // namespace
OLDNEW
« no previous file with comments | « chrome/browser/ui/webui/quota_internals_handler.cc ('k') | chrome/browser/ui/webui/task_manager_handler.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698