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

Side by Side Diff: ui/compositor/layer_unittest.cc

Issue 2539363004: Make base::Value::TYPE a scoped enum. (Closed)
Patch Set: Rebase Created 4 years 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
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
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 "ui/compositor/layer.h" 5 #include "ui/compositor/layer.h"
6 6
7 #include <stddef.h> 7 #include <stddef.h>
8 8
9 #include <memory> 9 #include <memory>
10 #include <utility> 10 #include <utility>
(...skipping 906 matching lines...) Expand 10 before | Expand all | Expand 10 after
917 std::string name = "\"\'\\/\b\f\n\r\t\n"; 917 std::string name = "\"\'\\/\b\f\n\r\t\n";
918 layer->set_name(name); 918 layer->set_name(name);
919 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info( 919 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info(
920 layer->TakeDebugInfo(layer->cc_layer_for_testing())); 920 layer->TakeDebugInfo(layer->cc_layer_for_testing()));
921 EXPECT_TRUE(debug_info.get()); 921 EXPECT_TRUE(debug_info.get());
922 std::string json; 922 std::string json;
923 debug_info->AppendAsTraceFormat(&json); 923 debug_info->AppendAsTraceFormat(&json);
924 base::JSONReader json_reader; 924 base::JSONReader json_reader;
925 std::unique_ptr<base::Value> debug_info_value(json_reader.ReadToValue(json)); 925 std::unique_ptr<base::Value> debug_info_value(json_reader.ReadToValue(json));
926 EXPECT_TRUE(debug_info_value); 926 EXPECT_TRUE(debug_info_value);
927 EXPECT_TRUE(debug_info_value->IsType(base::Value::TYPE_DICTIONARY)); 927 EXPECT_TRUE(debug_info_value->IsType(base::Value::Type::DICTIONARY));
928 base::DictionaryValue* dictionary = 0; 928 base::DictionaryValue* dictionary = 0;
929 EXPECT_TRUE(debug_info_value->GetAsDictionary(&dictionary)); 929 EXPECT_TRUE(debug_info_value->GetAsDictionary(&dictionary));
930 std::string roundtrip; 930 std::string roundtrip;
931 EXPECT_TRUE(dictionary->GetString("layer_name", &roundtrip)); 931 EXPECT_TRUE(dictionary->GetString("layer_name", &roundtrip));
932 EXPECT_EQ(name, roundtrip); 932 EXPECT_EQ(name, roundtrip);
933 } 933 }
934 934
935 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) { 935 TEST_F(LayerWithNullDelegateTest, SwitchLayerPreservesCCLayerState) {
936 std::unique_ptr<Layer> l1(CreateLayer(LAYER_SOLID_COLOR)); 936 std::unique_ptr<Layer> l1(CreateLayer(LAYER_SOLID_COLOR));
937 l1->SetFillsBoundsOpaquely(true); 937 l1->SetFillsBoundsOpaquely(true);
(...skipping 1316 matching lines...) Expand 10 before | Expand all | Expand 10 after
2254 layer.set_name("foo"); 2254 layer.set_name("foo");
2255 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info = 2255 std::unique_ptr<base::trace_event::ConvertableToTraceFormat> debug_info =
2256 layer.TakeDebugInfo(nullptr); 2256 layer.TakeDebugInfo(nullptr);
2257 std::string trace_format("bar,"); 2257 std::string trace_format("bar,");
2258 debug_info->AppendAsTraceFormat(&trace_format); 2258 debug_info->AppendAsTraceFormat(&trace_format);
2259 std::string expected("bar,{\"layer_name\":\"foo\"}"); 2259 std::string expected("bar,{\"layer_name\":\"foo\"}");
2260 EXPECT_EQ(expected, trace_format); 2260 EXPECT_EQ(expected, trace_format);
2261 } 2261 }
2262 2262
2263 } // namespace ui 2263 } // namespace ui
OLDNEW
« no previous file with comments | « tools/json_schema_compiler/util.cc ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698