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

Side by Side Diff: chrome/browser/extensions/api/sessions/sessions_apitest.cc

Issue 635573005: Cleanup: Better constify some strings in chrome/browser/{chromeos,extensions}. (Closed) Base URL: https://chromium.googlesource.com/chromium/src.git@master
Patch Set: rebase, nit Created 6 years, 1 month 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 2013 The Chromium Authors. All rights reserved. 1 // Copyright 2013 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/extensions/api/sessions/sessions_api.h" 5 #include "chrome/browser/extensions/api/sessions/sessions_api.h"
6 6
7 #include "base/command_line.h" 7 #include "base/command_line.h"
8 #include "base/path_service.h" 8 #include "base/path_service.h"
9 #include "base/strings/stringprintf.h" 9 #include "base/strings/stringprintf.h"
10 #include "chrome/browser/extensions/api/tabs/tabs_api.h" 10 #include "chrome/browser/extensions/api/tabs/tabs_api.h"
(...skipping 21 matching lines...) Expand all
32 #endif 32 #endif
33 33
34 namespace utils = extension_function_test_utils; 34 namespace utils = extension_function_test_utils;
35 35
36 namespace extensions { 36 namespace extensions {
37 37
38 namespace { 38 namespace {
39 39
40 // Fake session tabs (used to construct arbitrary device info) and tab IDs 40 // Fake session tabs (used to construct arbitrary device info) and tab IDs
41 // (used to construct arbitrary tab info) to use in all tests. 41 // (used to construct arbitrary tab info) to use in all tests.
42 const char* kSessionTags[] = {"tag0", "tag1", "tag2", "tag3", "tag4"}; 42 const char* const kSessionTags[] = {"tag0", "tag1", "tag2", "tag3", "tag4"};
43 const SessionID::id_type kTabIDs[] = {5, 10, 13, 17}; 43 const SessionID::id_type kTabIDs[] = {5, 10, 13, 17};
44 44
45 void BuildSessionSpecifics(const std::string& tag, 45 void BuildSessionSpecifics(const std::string& tag,
46 sync_pb::SessionSpecifics* meta) { 46 sync_pb::SessionSpecifics* meta) {
47 meta->set_session_tag(tag); 47 meta->set_session_tag(tag);
48 sync_pb::SessionHeader* header = meta->mutable_header(); 48 sync_pb::SessionHeader* header = meta->mutable_header();
49 header->set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_LINUX); 49 header->set_device_type(sync_pb::SyncEnums_DeviceType_TYPE_LINUX);
50 header->set_client_name(tag); 50 header->set_client_name(tag);
51 } 51 }
52 52
(...skipping 42 matching lines...) Expand 10 before | Expand all | Expand 10 after
95 void CreateTestProfileSyncService(); 95 void CreateTestProfileSyncService();
96 void CreateTestExtension(); 96 void CreateTestExtension();
97 void CreateSessionModels(); 97 void CreateSessionModels();
98 98
99 template <class T> 99 template <class T>
100 scoped_refptr<T> CreateFunction(bool has_callback) { 100 scoped_refptr<T> CreateFunction(bool has_callback) {
101 scoped_refptr<T> fn(new T()); 101 scoped_refptr<T> fn(new T());
102 fn->set_extension(extension_.get()); 102 fn->set_extension(extension_.get());
103 fn->set_has_callback(has_callback); 103 fn->set_has_callback(has_callback);
104 return fn; 104 return fn;
105 }; 105 }
106 106
107 Browser* browser_; 107 Browser* browser_;
108 scoped_refptr<extensions::Extension> extension_; 108 scoped_refptr<Extension> extension_;
109 }; 109 };
110 110
111 void ExtensionSessionsTest::SetUpCommandLine(CommandLine* command_line) { 111 void ExtensionSessionsTest::SetUpCommandLine(CommandLine* command_line) {
112 #if defined(OS_CHROMEOS) 112 #if defined(OS_CHROMEOS)
113 command_line->AppendSwitch( 113 command_line->AppendSwitch(
114 chromeos::switches::kIgnoreUserProfileMappingForTests); 114 chromeos::switches::kIgnoreUserProfileMappingForTests);
115 #endif 115 #endif
116 } 116 }
117 117
118 void ExtensionSessionsTest::SetUpOnMainThread() { 118 void ExtensionSessionsTest::SetUpOnMainThread() {
(...skipping 269 matching lines...) Expand 10 before | Expand all | Expand 10 after
388 return; 388 return;
389 #endif 389 #endif
390 390
391 ASSERT_TRUE(RunExtensionSubtest("sessions", 391 ASSERT_TRUE(RunExtensionSubtest("sessions",
392 "sessions.html")) << message_; 392 "sessions.html")) << message_;
393 } 393 }
394 394
395 } // namespace 395 } // namespace
396 396
397 } // namespace extensions 397 } // namespace extensions
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698