tests/ceftests/preference_unittest.cc
// Verify setting/getting preference values on shared global contexts.
Verify setting/getting preference values on shared global contexts.
Verify setting / getting preference values on shared global contexts .
TEST(PreferenceTest, GlobalSetGetShared) {
  CefRefPtr<CefWaitableEvent> event =
      CefWaitableEvent::CreateWaitableEvent(true, false);
  CefRefPtr<CefRequestContext> context = CefRequestContext::GetGlobalContext();
  EXPECT_TRUE(context.get());
  CefRefPtr<CefRequestContext> context2 =
      CefRequestContext::CreateContext(context, nullptr);
  EXPECT_TRUE(context2.get());
  CefRefPtr<CefRequestContext> context3 =
      CefRequestContext::CreateContext(context, new TestRequestContextHandler);
  EXPECT_TRUE(context3.get());
  CefRequestContextSettings settings;
  CefRefPtr<CefRequestContext> context4 = CefRequestContext::CreateContext(
      settings, new TestRequestContextHandler(event));
  EXPECT_TRUE(context4.get());
  event->Wait();
  *PendingAction() = "Set/get the values on the first context";
  ValidateSetGet(context, event);
  event->Wait();
  *PendingAction() = "Get the values from the 2nd context.";
  ValidateGet(context2, event);
  event->Wait();
  *PendingAction() = "Get the values from the 3rd context.";
  ValidateGet(context3, event);
  event->Wait();
  *PendingAction() = "Get the values from the 4th context.";
  if (IsChromeRuntimeEnabled()) {
    ValidateGet(context4, event);
  } else {
    ValidateDefaults(context4, false, event);
  }
  event->Wait();
  *PendingAction() = "Reset to the default values.";
  ValidateDefaults(context, true, event);
  event->Wait();
}
TEST ( PreferenceTest , GlobalSetGetShared ) { CefRefPtr < CefWaitableEvent > event = CefWaitableEvent :: CreateWaitableEvent ( true , false ) ; CefRefPtr < CefRequestContext > context = CefRequestContext :: GetGlobalContext ( ) ; EXPECT_TRUE ( context . get ( ) ) ; CefRefPtr < CefRequestContext > context2 = CefRequestContext :: CreateContext ( context , nullptr ) ; EXPECT_TRUE ( context2 . get ( ) ) ; CefRefPtr < CefRequestContext > context3 = CefRequestContext :: CreateContext ( context , new TestRequestContextHandler ) ; EXPECT_TRUE ( context3 . get ( ) ) ; CefRequestContextSettings settings ; CefRefPtr < CefRequestContext > context4 = CefRequestContext :: CreateContext ( settings , new TestRequestContextHandler ( event ) ) ; EXPECT_TRUE ( context4 . get ( ) ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateSetGet ( context , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateGet ( context2 , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateGet ( context3 , event ) ; event -> Wait ( ) ; * PendingAction ( ) = " " ; if ( IsChromeRuntimeEnabled ( ) ) { ValidateGet ( context4 , event ) ; } else { ValidateDefaults ( context4 , false , event ) ; } event -> Wait ( ) ; * PendingAction ( ) = " " ; ValidateDefaults ( context , true , event ) ; event -> Wait ( ) ; }
Verify setting/getting preference values on shared global contexts.
Verify setting / getting preference values on shared global contexts .
// Sharing storage. // Sharing storage. // Unassociated context. // Wait for the context to be fully initialized. // Set/get the values on the first context. // Get the values from the 2nd and 3rd contexts. They should be the same. // Get the values from the 4th context. // With the Chrome runtime, prefs set via an incognito profile will become // an overlay on top of the global (parent) profile. The incognito profile // shares the prefs in this case because they were set via the global // profile. // They should be at the default. // Reset to the default values.